I need help with my assignments. Please they are due 2/18/15

My teacher hasn't really taught me how to do these and I can't get ahold of him and I need a good grade. Hopefully someone will understand and help me. Thanks!


1. Create the test cases (not code, not pseudocode, but test cases – see note 3 below)) for the following problem:

Problem: Read in three integers and print the count of how many are positive.

Show both the input and the expected output.
Save your data in a text file named, testdata.txt

When writing your test cases, consider the position of the positive number in the input and how many there are in an input cases. There are 8 unique test cases in this problem. Obviously, 8 cases does not include every possible integer, but does include every possible sign (+ or -) in every possible position (first, second, third). The file turned in is a text file containing an explanation of the test cases to be used to test the program once it is written.

NOTE 1: This part of the assignment is NOT to write a program nor to write an algorithm. NO CODE is written for this part.

NOTE 2: positive means greater than zero.

NOTE 3: A test case gives input to be used and the expected output for that input. For this assignment, an example of some input might be given either as "+ - -" or "7, 0, -1" and the expected output (for this example) would be given as "1" (the number of positive values in the input).



2. Write the program countPositive that solves previous problem. Your program should

print a title for the program
prompt for the input
print the result, that is, the number of input values that are greater than 0, i.e., positive.

Assume that all values are integers. Store your program in the file countPositive.cpp. Be sure to check your answers.

3Write the program myGrade.cpp that will calculate a grade for this class. The input for the program is three integers, obtained from the user in the following order:

total exam points
total homework (MPL) points
total assignment points

The output should be

the total points entered
the final letter grade ( A .. F )
why that letter grade was assigned (Usually the point percentage of the total 1000 is the reason for the letter grade assigned. However, if a student earns less than 240 points on the two exams, this could override the actual percentage. When this happens, mention it as part of the reason the letter grade was assigned.)

See the Grading Information on the Course Information page for information on how to calculate a grade. [Use the grading info for the Fall and Spring semesters even if you are taking this course during the summer. Grading for fall and spring semester includes programming assignments, exams and homework done in MPL – this is what you use as the requirements for this assignment, even in a summer session.]
Pay attention to the requirement that the total points earned on the exams must be 240 in order to get higher than an F. This can take precedence over the actual percentage of points earned.

Assume that all values are integers. If any of the values entered are negative, then print an error message. Do not calculate a grade for negative points, but display an error message instead. Do not check the values for any maximum values, such 400 or 200 -- allow the user to enter totals that are over the maximums for each part of the grade. Be sure to use named constants (const) for all magic numbers (such as 240, 900, 800, 700, etc.).

Store your program in the file myGrade.cpp. Be sure to check your answers.


4. Write the program convertChar that will read in one character (type, char) and then

if the input is uppercase, print the lowercase letterif the input is lowercase, print the uppercase letter
if the input is anything else, just print the character

When testing a character, use the character value, not the ASCII (numeric code) value. For example, use 'a' rather than 97.

Also, do not write an if-statement for every possible character. Rather, use a range check to determine whether the char variable's value is within a particular range. For example, if the char variable (input) is between 'a' and 'z', inclusive, then the input was lower case. Your code must have no more than TWO if-statements.

Be sure to prompt the user for input and label all results.

Your programs execution should produce output like the following examples (user input in bold blue):

Example 1:
Enter a character: h
The uppercase of 'h' is 'H'.

Example 2:
Enter a character: B
The lowercase of 'B' is 'b'.

Example 3:
Enter a character: ]
You enter non-letter, ']'.

NOTE: The examples above are EXAMPLES! Your code should work for any character that the user might enter.

Store your program in the file convertChar.cpp. Be sure to check your answers.


5. Write the program calculate that will read in two double values and then an integer. If the integer is 1, then print the sum of the doubles; if the integer is 2, then print the product of the doubles; if the integer is 3, print the doubles in ascending (increasing) order; if the integer is any other value, print an error message.

You must use a switch statement to test the integer input. You can assume that the first two inputs are double and that the third input is an integer. Be sure to prompt the user for input and label all displayed results.

Be sure not to do any of the three possible calculations unless and until the corresponding integer value is entered. In other words, only add the values if the integer is 1, only multiply if the integer is 2 and only sort them if the integer is 3.

Store your program in the file calculate.cpp. Be sure to check your answers.
http://lmgtfy.com/?q=C%2B%2B+beginner+tutorial

however, your assignment is tomorrow so i wish you good luck.

you could try this side, it looks like it provides much information:
http://www.online-tutorials.net/c-c++-c/c++-tutorial-teil-1/tutorials-t-1-58.html
Last edited on
Topic archived. No new replies allowed.