rse has the following
Page
1
of
2
1.
Wri
te a grading program for an instructor whose cou
rse has the following
policies:
•
Two quizzes, each graded on the basis of 10 points, are given.
•
One midterm exam and one final exam, each graded on the basis of 100
points, are given.
•
The final exam coun
ts for 50 percent of the grade, the midterm counts for 25
percent, and the two quizzes together count for a total of 25 percent. (Do not
forget to normalize the quiz scores. They should be converted to percentages
before they are averaged in.)
Any grade o
f 90 percent or more is an A, any grade between 80 and 89 percent
is a B, any grade between 70 and 79 percent is a C, any grade between 60 and
69 percent is a D, and any grade below 60 percent is an F.
The program should read in the student’s scores and di
splay the student’s
record, which consists of two quiz scores, two exam scores, the student’s total
score for the entire course, and the final letter grade. The total score is a number
in the range 0 to 100, which represents the weighted average of the stu
dent’s
work.
Define and use a class for the student record. The class should have instance
variables for the quizzes, midterm, final, total score for the course, and final
letter grade. The class should have input and output methods. The input method
shou
ld not ask for the final numeric grade, nor should it ask for the final letter
grade. The class should have methods to compute the overall numeric grade and
the final letter grade. These last two methods will be
void
methods that set the
appropriate instan
ce variables. Remember, one method can call another method.
If you prefer, you can define a single method that sets both the overall numeric
score and the final letter grade, but if you do this, use a helping method. Your
program should use all the methods
described here. Your class should have a
reasonable set of accessor and mutator methods, whether or not your program
uses them.
You may add other methods if you wish.
Page
2
of
2
2.
Consider a class
ConcertPromoter
that records the tickets sold
for a
performance. Before the day of the concert, tickets are sold only over the
phone. Sales on the day of the performance are made only in person at the
concert venue. The class has the following attributes:
•
The name of the band
•
The capacity of the
venue
•
The number of tickets sold
•
The price of a ticket sold by phone
•
The price of a ticket sold at the concert venue
•
The total sales amount
It has methods to
•
Record the sale of one or more tickets
•
Change from phone sales to sales at the concert
venue
•
Return the number of tickets sold
•
Return the number of tickets remaining
•
Return the total sales for the concert
a.
Write a method heading for each method.
b.
Write preconditions and postconditions for each method.
c.
Write some Java statements
that test the class.
d.
Implement the class.
e.
List any additional methods and attributes needed in the implementation that
were not listed in the original design. List any other changes made to the
original design.
f.
Write a program using the class you
wrote for Part
d
that will be used to
record sales for a concert. Your program should record phone sales, then sales
at the venue. As tickets are sold, the number of seats remaining should be
displayed. At the end of the program, display the number of tic
kets sold and the
total sales amount for the concert.
9 years ago
Purchase the answer to view it

- JavaApplication37.zip