solidcrowd
10+ year member
CarAudio.com Elite
I have no idea what to do!!! //content.invisioncic.com/y282845/emoticons/confused.gif.e820e0216602db4765798ac39d28caa9.gif, Due in the morning. If anyone could help out or just do part of the problems, so I don't fail the whole thing, I would greatly appreciate it.
(1a) Use a for loop to add the positive odd numbers less than 100. Output the total.
(1b) Use a while loop to add the positive even numbers less than 50. Output the total
(1c) Use a nested loop structure to compute and print the powers from 1 to 10 of the numbers 2, 3, 4, 5, 6, 7.
(1d) Assume you have the following variable char accountType;
which can have an upper or lower case letter ( c or C for checking account) ( s or S for savings account)
( l or L for loan account).
Write a switch statement that outputs an appropriate message to show the value of the current account type, and prints a reasonable message if the account type is not one of the three types given in this problem.
(2) Write a program in C++ that does the following using file input and common output
• read in the number of students in the class
• read in the number of test scores that each student should have completed
• repeat for each student
read the specified number of student scores
compute the average of a student’s scores
determine the letter grade earned by a student using the following criteria
A average between 90 to 100
B average greater than or equal to 80 but less than 90
C average greater than or equal to 70 but less than 80
U unsatisfactory if less than 70
output a student’s scores, average and letter grade appropriately labeled
Sample output expected from the program:
Student 1: Average = 95.2 Grade = A
Student 2: Average = 88.3 Grade = B
Student 3: Average = 75.2 Grade = C
Student 4: Average = 55.2 Grade = U
// you can assume the correct header files are included
// assumption – valid and complete data is stored in a file called scores.txt
int numOfStudents; // identifies the number of student data lines in file
int numOfscores; // identifies the number of test scores for each student
ifstream inData;
inData.open(“scores.txt”);
inData >> numOfStudents;
inData >> numOfScores;
// remainder of the data in the file is the appropriate number of student scores
(1a) Use a for loop to add the positive odd numbers less than 100. Output the total.
(1b) Use a while loop to add the positive even numbers less than 50. Output the total
(1c) Use a nested loop structure to compute and print the powers from 1 to 10 of the numbers 2, 3, 4, 5, 6, 7.
(1d) Assume you have the following variable char accountType;
which can have an upper or lower case letter ( c or C for checking account) ( s or S for savings account)
( l or L for loan account).
Write a switch statement that outputs an appropriate message to show the value of the current account type, and prints a reasonable message if the account type is not one of the three types given in this problem.
(2) Write a program in C++ that does the following using file input and common output
• read in the number of students in the class
• read in the number of test scores that each student should have completed
• repeat for each student
read the specified number of student scores
compute the average of a student’s scores
determine the letter grade earned by a student using the following criteria
A average between 90 to 100
B average greater than or equal to 80 but less than 90
C average greater than or equal to 70 but less than 80
U unsatisfactory if less than 70
output a student’s scores, average and letter grade appropriately labeled
Sample output expected from the program:
Student 1: Average = 95.2 Grade = A
Student 2: Average = 88.3 Grade = B
Student 3: Average = 75.2 Grade = C
Student 4: Average = 55.2 Grade = U
// you can assume the correct header files are included
// assumption – valid and complete data is stored in a file called scores.txt
int numOfStudents; // identifies the number of student data lines in file
int numOfscores; // identifies the number of test scores for each student
ifstream inData;
inData.open(“scores.txt”);
inData >> numOfStudents;
inData >> numOfScores;
// remainder of the data in the file is the appropriate number of student scores
