Saturday, May 22, 2010

Help with C++ programming?

Write a program that asks for the end user's name and for the scores on three class exams, each based on 100 points. If the average of the three exams carries a weight of 2/3 towards the final grade and the final-exam score carries a weight of 1/3 towards the final grade, the program ought to


A) ask for the end user's name (both the first and the last name)


B) greet the end user with his/her name,


C) Calculate the minimum score necessary on the final exam so that the end user will pass with a "C", not a "C-" nor a "C+"


and


D) print out the necessary score for the end user in a complete statement referring to the user by name.





note tha a C grade is from 73.0 to 77.0


I am a beginner, it will be better if you put basic codes.


Thank you

Help with C++ programming?
ok i wont write this all out for you but ill give you some pointers


i assume you know how to start off writing the program with you main function and all


so you are going to need to create some variables


you need a string for the first and last name so it might look like this





string strFirstName, strLastName;





then you need something for the test scores since this is a small program and dealing with huge numbers just use a double for these and have a different one for each grade you will work with





double dblTest1, dblTest2, dblTest3, dblTestTotal, dblFinal;





there are ways to do it with a lot fewer variables but im keeping it really simple





then you will need to get the information from the user. for this use cin and cout statements for example





cout %26lt;%26lt; "please enter your first name: ";


cin %26gt;%26gt; strFirstName;





repeat that for all of the info you need to get from the user





once you have all the info from the user you can get down to the math part. here is where i would suggest that you spend a few min thinking up a good equation like





finaltestscore = ((73 * 3) - ((test1 + test2 + test3) / 3 * 2));





i would need to know more about how your teacher wants all the rounding and such done to make it work the way she wants but this will get you on the right track





then when your done you just need a cout to output all of the info you need





cout %26lt;%26lt; strFirstName %26lt;%26lt; " " %26lt;%26lt; strLastName %26lt;%26lt; " you will need a score of: " %26lt;%26lt; dblFinal %26lt;%26lt; " in order to get a C for the class"%26lt;%26lt;endl;





you might also want to figure out the lowest avg that the user can have and still get a C and change the last line with an if / else statement





if you have any questions need help or want someone to check your code email me at aceofspades911@yahoo.com
Reply:I could answer this--for $20.
Reply:Do your own homework or you will get a C yourself.





I just fired someone yesterday because he couldn't write a proper code. I think he wished he had done his homework himself.





I decided to add written tests during interview because of this.
Reply:have you tried doing your homework on your own first? lol you know, i'm telling you this for your own good...C++ is a very difficult language...if you don't do your own homework (and/or projects), you will fail the course. what you're asking is not that complicated, so maybe you should try it first...you haven't even tried


No comments:

Post a Comment