| | |
C++ Homework #1
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2008
Posts: 6
Reputation:
Solved Threads: 0
CS540 Homework #1 Spring 2008
Due Monday 2/4/08 at midnight
This assignment is a review of CS530 material. It is probably the most difficult program this semester!
Be sure to include the following information in comment statements at the beginning of your program: Your name, Homework # 1 and a brief description of the assignment.
ALSO PLEASE INCLUDE THE return 0; statement in main.
The grade you receive will be based on 4 components:
(1) it compiled
(2) it ran
( 3) it gave correct output
(4) programming style (clarity, organization, use of functions, documentation).
Grades will range from 0 - 10.
No extensions on the programs unless I agree to it; Each program is to be handed in electronically by midnight on the due date.
Write your code in a file called hw1.cpp and submit it electronically using the dropbox for the assignment on the eCollege website.
The following information has been recorded for each of the students in a certain computer science course:
student name in the form LAST,FIRST at most 20 characters long (no embedded blanks)
score on Midterm ( an integer in the range 0 100)
score on Final Exam (an integer in the range 0 100)
12 homework/quiz grades (each an integer in the range 0 10)
We wish to store all the pertinent information for an individual student in a struct, called A_STUDENT.
In particular, one part of the struct should be an array to hold the particular student's 12 homework/quiz grades.
We wish to store the information for all the students in the entire class as a single array of structs, called THE_CLASS; You may assume that there are at most 10 students in the class, but you don’t know how many there are beforehand and may not ask.
Write and run a C++ program using the compiler of your choice, that will print out the following information in a single table* with an appropriate header line to the screen: the student’s name, his score on the Midterm, his overall homework_quiz grade, his score on the final exam, his course average (carried out to 2 decimal places), and his letter grade for the course, WHERE
1. the homework quiz grade is obtained by passing a function HQGRADE a particular student's array of 12 homework quiz grades and having the function return the sum of the best ten grades (this will be an integer in 0 100) .
2. student's average = .30(Midterm + Final) + .40(HQGRADE)
3. course grades are determined as follows:
average grade for course
90 – 100 A
80 <<90 B
70 <<80 C
below 70 F where << means less than, but not equal to
*Have the students displayed in the table in decreasing order of their final average.
INPUT: Call the input file data1.txt. I’ve included some sample input below, BUT your code should run for ANY input file! Please include the code for inputting the file in your program……DO NOT INPUT THE DATA VIA THE COMMAND LINE.
Sample input format: (note the word name , etc is NOT in the input file)
name Doe,John
midterm. Final 78 82
12 homework quiz grades 4 5 8 9 10 10 8 7 4 8 9 10
SAMPLE INPUT:
Smith,Tom
90 100
10 10 10 10 10 10 2 1 10 10 10 10
Jones,Mary
90 90
1 2 3 4 5 6 7 8 9 10 10 10
Grieco,Linda
100 100
10 10 10 10 10 10 10 10 10 10 10 10
Ball,Lucille
50 90
10 10 2 7 10 1 1 10 10 10 10 10
OUTPUT: Have your program print the output table to the screen
SAMPLE OUTPUT:
Name Midterm HQAvg Final Avg Grade
Grieco,Linda 100 100 100 100 A
Smith,Tom 90 100 100 97 A
Jones,Mary 90 72 90 82.8 B
Ball,Lucille 50 89 90 77.59 C
Due Monday 2/4/08 at midnight
This assignment is a review of CS530 material. It is probably the most difficult program this semester!
Be sure to include the following information in comment statements at the beginning of your program: Your name, Homework # 1 and a brief description of the assignment.
ALSO PLEASE INCLUDE THE return 0; statement in main.
The grade you receive will be based on 4 components:
(1) it compiled
(2) it ran
( 3) it gave correct output
(4) programming style (clarity, organization, use of functions, documentation).
Grades will range from 0 - 10.
No extensions on the programs unless I agree to it; Each program is to be handed in electronically by midnight on the due date.
Write your code in a file called hw1.cpp and submit it electronically using the dropbox for the assignment on the eCollege website.
The following information has been recorded for each of the students in a certain computer science course:
student name in the form LAST,FIRST at most 20 characters long (no embedded blanks)
score on Midterm ( an integer in the range 0 100)
score on Final Exam (an integer in the range 0 100)
12 homework/quiz grades (each an integer in the range 0 10)
We wish to store all the pertinent information for an individual student in a struct, called A_STUDENT.
In particular, one part of the struct should be an array to hold the particular student's 12 homework/quiz grades.
We wish to store the information for all the students in the entire class as a single array of structs, called THE_CLASS; You may assume that there are at most 10 students in the class, but you don’t know how many there are beforehand and may not ask.
Write and run a C++ program using the compiler of your choice, that will print out the following information in a single table* with an appropriate header line to the screen: the student’s name, his score on the Midterm, his overall homework_quiz grade, his score on the final exam, his course average (carried out to 2 decimal places), and his letter grade for the course, WHERE
1. the homework quiz grade is obtained by passing a function HQGRADE a particular student's array of 12 homework quiz grades and having the function return the sum of the best ten grades (this will be an integer in 0 100) .
2. student's average = .30(Midterm + Final) + .40(HQGRADE)
3. course grades are determined as follows:
average grade for course
90 – 100 A
80 <<90 B
70 <<80 C
below 70 F where << means less than, but not equal to
*Have the students displayed in the table in decreasing order of their final average.
INPUT: Call the input file data1.txt. I’ve included some sample input below, BUT your code should run for ANY input file! Please include the code for inputting the file in your program……DO NOT INPUT THE DATA VIA THE COMMAND LINE.
Sample input format: (note the word name , etc is NOT in the input file)
name Doe,John
midterm. Final 78 82
12 homework quiz grades 4 5 8 9 10 10 8 7 4 8 9 10
SAMPLE INPUT:
Smith,Tom
90 100
10 10 10 10 10 10 2 1 10 10 10 10
Jones,Mary
90 90
1 2 3 4 5 6 7 8 9 10 10 10
Grieco,Linda
100 100
10 10 10 10 10 10 10 10 10 10 10 10
Ball,Lucille
50 90
10 10 2 7 10 1 1 10 10 10 10 10
OUTPUT: Have your program print the output table to the screen
SAMPLE OUTPUT:
Name Midterm HQAvg Final Avg Grade
Grieco,Linda 100 100 100 100 A
Smith,Tom 90 100 100 97 A
Jones,Mary 90 72 90 82.8 B
Ball,Lucille 50 89 90 77.59 C
![]() |
Similar Threads
- We only give homework help to those who show effort (Computer Science)
- Need help with Computer Science homework (Computer Science)
- Dynamic memory allocation homework (C++)
- Homework Help!! Priority Queue ?? (Computer Science)
Other Threads in the C++ Forum
- Previous Thread: The Calendar Program
- Next Thread: read text file into array
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream input int integer java lib linux list loop looping loops map math matrix memory multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates text tree url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





??
