Chukxy's Posts
Nairaland Forum › Chukxy's Profile › Chukxy's Posts
In as much I am not supporting the police for their brutality on innocent Nigerians;in this particular scenario, I would blame the Beauty Queen for what happened to her. In her story, she gave excuses or justifications why she should move out from the main traffic to the shortest route. But what she forgot was that every other person in the traffic at that point in time has a justifiable excuse to obstruct the traffic or take a shortest root. Just imagine everybody doing that at that point in time, is better imagined what chaos would haven taken place at that point in time. I know quite well that if she had considered the possible challenge she would face to accomplish the task she had at hand on time and made a proper plan, she could have left her house on time, probably she may not have met the traffic jam; even if she met the traffic jam, she could have been patient enough to follow the main traffic and saved herself from this embarrassment. Anyway I am sorry to what happened to her. It is lesson to her and all of us to imbibe the habit of meeting appointment before schedule so we can always compensate for any eventuality like this. |
@poster, the person is telling you the truth. With programming and database the sky is your starting point. For you to be good at it, you have to sacrifice a lot and determination is the key. Wish you the best! |
#include <stdio.h> #include <conio.h> int main() { int noBottle,noStudent,sugar,cubePerMonth; //declaration of variables noStudent = 1500; sugar = 300; printf("\n Please enter the no of bottle consumed by each student in week \n" ;scanf("%d",&noBottle); //gets the value from user while(noBottle< 0) //validates the user input { printf("\n Please enter a valid value\n" ;scanf("%d",&noBottle); } cubePerMonth = (noBottle*noStudent*sugar*4)/24; printf("The no of cube consumed in a month =%d",cubePerMonth); -getche(); return 0; } @ oga jacob05, if it is this way you want the code to be, then I would sack you as your employer because of the following reason: 1. you have not justified your pay as a programmer, ordinary calculator or smart phone would accomplish the task ahead faster. 2. you have not implemented in your code the concept or re-usability,scalability,maintainability etc. 3. you did not think outside the box to know the relevance of this task to your employer(in this case coca cola) 4. Finally, you did not consider that you are working as a team of developers/programmers. Thinking Differently: The relevance of this task to your employer includes among others the following: 1. to be able to calculate the total number of bottles they need for their production in a month not just the one consumed by the school in question but also from other customers. 2. to calculate the no of crates they need for the production in a month. 3.to calculate the total amount of sugar the need and the total cost of production. 4. to generate the reports, graphs for management personnel. When you are thinking differently, you would know that for you to accomplish the task list above, you only need to call the functions I defined in my former code and loop through them with certain values and your objective would be achieved. Also other member of your team can import the file and use any of the function to accomplish the set task. Doing it the way I did it before, automation is achieved and not just to do input and output as reflected in the second code. Oga jacob do you understand where I am coming from now? |
Yes, I am in full support of what googles said. You have to embrace the change that is taking place in his life. Do not let the event of the past to be a stumbling block, lest you regret the action. We do make mistakes in life and sometime we equally have reflection of our past and turn a new leaf. I rather you seize this opportunity to have a heart to heart discussion with him on why he behaved the way he did and the way forward .Also,both of you should now chat a new way you want your family to be. Wish you a revigorated happy married life! |
@ marcus1234 what do you mean? |
Hi jacob05, I know I omitted scanf("%d",",&no_b) in my while loop. Again I broke the calculations to different functions for the person I am communicating to understand. I can use three functions to achieve this task or even lump everything in the main function; but this would make it difficult for the reader to understand. The code is long because is set to automate the task; not just to calcutate for three bottles consumed in a week but any amount consumed,that is the reason it is program at the first instance. If it is meant to just solve the problem at hand, 6 lines of code can solve it. Always watch your statement in a public forum. If you know it vey well, all you could do is do the right thing rather than rubbishing someones effort ok? Also point out where I made mistake in my calculation or better still paste your own version of the soultion. |
You are welcome! |
I don't normally like to comment on issue like this because I see programming language as a working tool for programmers/developers. You can always achieve what you want to achieve if you know how to use the language effectively. Again the choice of language to study is based on your personal target or ambition. Like me, I started in the following order -Qbasic,Java,C and scripting languages(javascript,php,ajax). Haven explored, I want to settle for Java and C. Java because I want to be developing secured enterprise applications and I think java has all it takes. C because I also want to be Hardware and system programmer and also think C has all it takes. I am still exploring, would still explore c++ and C# in very short while. For, beginners I would I advise to start from C as It will introduce you to the rudiment of programming since it has very little library. You are forced to do almost all the coding by your self. By the time you finish learning C, learning other programming languages would be very easy as you have known almost all it takes to program. This is my personal opinion. |
@joefazee , why did you say he should avoid microsoft based langauge, do you have any reason for that? |
I would tackle this challenge this way: #include <stdio.h> #include <conio.h> #define CUBE_PER_CRATE 300 #define TOTAL_NO_STUDENT 1500 int get_no_bottle_per_week(); int calculate_no_crate_per_month(int no_bottle); int calcutate_no_cube_per_month(int no_crate); void print_result(int cube_per_mont); int main(void) { int no_bottle_per_student,no_crate_per_month,no_cube_per_month; no_bottle_per_student =get_no_bottle_per_week(); no_crate_per_month =calculate_no_crate_per_month(no_bottle_per_student ); no_cube_per_month =calcutate_no_cube_per_month( no_crate_per_month); print_result(no_cube_per_month ); _getche(); return 0; } int get_no_bottle_per_week(){ int no_b; printf("\n Please enter the no of bottle consumed by a student in a week \n" ;scanf("%d",&no_b); while(no_b<0) { printf("\n Please enter a valid value \n" ;} return no_b; } int calculate_no_crate_per_month(int no_bottle) { int no_crate, no_bottle_per_month; no_bottle_per_month= TOTAL_NO_STUDENT *no_bottle*4; no_crate =no_bottle_per_month/24; return no_crate; } int calcutate_no_cube_per_month(int no_crate) { return no_crate*CUBE_PER_CRATE ; } void print_result(int cube_per_mont) { printf("\n The no cube consumed in a month is %d \n",cube_per_mont); } the ans using C programming is shown on the screen shot attached. It is assumed that we hv 4 weeks in month(fact). You can relate to c++. I think what you to need to change is the input and output function.
|
I have taken down ur id, would chat with you later as I have an appointment now. |
I have overcome my challenge, Thank you for viewing! ![]() |
I have overcome the second challenge but the first one is still pending( i.e unable to retrieve all the image files and id from the database and displaying all of them in a table at once). I am beginning to think something is wrong with my post, as each time I seek for help on the challenge I am facing I rarely get reply. If there is anything wrong, I am ready to take correction. |
Chee!! Ebulengwa atokwala n'obe! Nairaland java gurus want to abandon one of their own! Somebody hold me before I do this: import java.justice.*; import java.police.*; import javax.swing.*; import java.awt.*; public class MyAction extends Court implements PoliceListener{ private boolean challenge_status; private JButton takeAction; public MyAction() { JPanel p1 = new JPanel(new GridLayout(0,1)); challenge_status = getChallengeStatus(); takeAction = new JButton("TakeAction" ;p1.add(challenge_status); p1.add(takeAction); add(p1,BorderLayout.CENTER); takeAction.addPoliceListener(this); } private boolean getChallengeStatus() { boolean status ; if(Problem solved) { status =true; } if(!(Problem solved)) { status = false; } return status; } public void actionPerformed(ActionEvent ae) { Object o = ae.getSource(); if(challenge_status== true by the end of the day) { doMyFavouriteHobby("Dance" ;takeAllNairaLandGuruToBurgerKing("Thrill them with unprecedented fun" ;giveAllMoney("10 Pounds" ;System.out.println("I am very happy" ;} else { if(challenge_status==false by the end of the day) { startCrying("All through the nite" ;System.out.println("I have been crying" ;} if(challenge_status==false by the end of two days) { crashMyLaptop("Yes do it" ;commitMurder("Kill myself" ;arrestAllNairalandGuru(); jailForTenYrs("For manslaughter and indifference" ;System.exit(0); } } public static void createGUI() { JFrame jf = new JFrame("My Action" ![]() jf.add(new MyAction()); jf.pack(); jf.setVisible(true); } public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable(){ public void run(){ createGUI();}}); } } |
I uploaded some pictures to database(mysql) with id numbers. If I want to retrieve the picture with id no, it works very ok as shown on the screen shot attached(chuksproj2.jpg) but the challenge is I want to retrieve all the pictures in the database with the id number using table to display them at once. It worked but the picture did not show on the column as it is suppose to be as shown(chuksproj3.jpg). The second challenge I am facing is that when I jar an application connected to database, It does not retrieve results from the database but If I run the same from the command line, it works on fine. I was thinking may be I was not doing it well, but when I jarred the one that uploads the files to the same database using the same method, it worked very fine as shown in (chuksproj1.jpg). Please can anybody give me suggestion on how to overcome this challenge. Thank you in anticipation.
|
Please can someone give me a link to watch the match online! |
Hi @poster! Your post just caught my attention. To my opinion, a programmer should bother himself or herself with the task of delivering specific solutions to individuals, organizations,companies etc. To me that is why they earn much more money, because they solve specific problems or challenges facing these individuals,organzations ect. It also differentiate them from off shalve or generalised software which are many out there and which tend to solve generalised problems. If you decide to go on tackling generalised problems, you will find out that you will face very stiff competition as there are many tested and trusted softwares out there. Moreso, people would easily patronize the established names in the software market than new entrance in the market. I think lucrative part of software development lies on specialisation and specification, that is why there would not be too many developers as far as the world continue to exist. This is not to discourage you but my humble opinion. |
@Canachy, I must commend you for your good works and kind gesture. More power to your elbow! Please could you clarify why Assembly language is preferred to other languages for programming Microcontrollers. For now, I have knowledge of C but not Assembly Language that is why I am inquisitive. I very much interested in Embedded Systems. |
@ poster, I am not c++ programmer, i think you made mistake in your sort function and have corrected it. Tried compiling it with c++ compiler but there is syntax error in this line of code /* cout<<sort(a,6)<<endl; */; hence, I compiled it wth c and it worked. You can modify the function and correct the syntax error in c++ and it will work fine. #include <stdio.h> #include <stdlib.h> #include <conio.h> void sort(int a[], int n); int main () { int a[] = {84,69,76,86,94,91}; sort(a,6); int c; for(c=0;c<6;c++) { printf("%d\n",a[c]); } _getche(); return 0; } void sort(int a[], int n) { int temp,i,j; for(i = 0;i<n-1;i++) for( j = n-1; j > i;j--) { if(a[j-1] > a[j]) { temp = a[j]; a[j] = a[j-1]; a[j-1] = temp; } } } Cheers! |
@ Sagbar, glad to know you are studying EE . Would you mind us sharing experiences in some of the courses we are doing now, such as: Tina, Matlab, C ,C++,Java,DECO etc. By so doing, we learn more. |
@silentc , thank you for your advice; I'm impressed! |
Thanks! You are the best! |
Thanks for your willingness to help! I am currently studying BEng Digital Systems and Computer Eng. Most jobs I have come across are mainly Electrical and Electronics Eng. and Telecommunication or ICT Eng. |
Thank you so much for your educative reply. The motive behind my question is that I am currently studying Digital Systems and Computer Engineering. And my desire for this course is to work in Telecoms industry after graduation, then start my own after sometime. However, the job prospects I have seen so far did not include the course i am doing specifically. Hence, I am in dilemma to switch to Digital Communication and Electronics Engineering. That was why I asked for the relevance of the course to Telecoms Industry. |
@ poster this might help you. #include <stdio.h> #include <stdlib.h> #include <conio.h> void Count_Number_of_occurrence(int *Engchar1,int *space1,int *digit1, int *other1); void print_result(int *Engchar2,int *space2,int *digit2, int *other2); int main() { int Engchar,space,digit,other; Count_Number_of_occurrence(&Engchar,&space,&digit,&other); print_result(&Engchar,&space,&digit,&other); _getche(); return 0; } void Count_Number_of_occurrence(int *Engchar1,int *space1,int *digit1, int *other1) { int Eng,spac,dig,oth; Eng=0; spac=0; dig=0; oth=0; char ch; int loop=0; printf("\n Please enter a statement \n" ;while(((ch=(char) getche())!='\0')&&(loop<50)) { if(ch==' ') spac++; else if(ch>='0'&&ch<='9') dig++; else if(((ch>='a')&&(ch<='z'))||((ch>='A')&&(ch<='Z'))) Eng++; else oth++; loop++; } *Engchar1=Eng; *space1=spac; *digit1=dig; *other1=oth; } void print_result(int *Engchar2,int *space2,int *digit2, int *other2) { printf("\n Number of English Characters = %d\n",*Engchar2); printf("\n Number of Space = %d\n",*space2); printf("\n Number of digits = %d\n",*digit2); printf("\n Number of other characters = %d\n",*other2); } |
@ poster. Though I don't have suggestion on where u will do it in Lagos, but just want you if you don't mind to share your idea where u want to apply it. We are presently doing it in school now but I am not having full interest about the package. May be your idea about it may motivate me. Thanks in anticipation. |
@ poster, there is no problem with your code, it worked. You only omitted the last brace }; hence: public class HelloUser { public static void main(String[] arguments) { String username = System.getProperty("user.name" ;System.out.println("Hello " + username); } } I think your challenge is that you have not set the classpath properly. |
Good people, I want you to educate me on the role of a Digital Systems and Computer Engineer in Telecommunication's Industry. |
I thank God that I have overcome my challenge. I am sort of disappointed that nobody even suggested how to go about it, if it were to debate on the best programming language , i would have received more than a thousand response. Thanks but no thanks! |
;