Friday

Continuing on the crypto converter exercise

Exercise 1:

Write a Java program that determines a student’s grade. The program will read three types of scores(quiz, mid-term, and final scores) and determine the grade based on the following rules:

  • if the average score >=90% =>grade=A

  • if the average score >= 70% and <90% => grade=B

  • if the average score>=50% and <70% =>grade=C

  • if the average score<50% =>grade=F

See the example output below:

Quiz score: 80

Mid-term score: 68

Final score: 90

Your grade is B

Exercise 2:

Write a Java program to calculate the revenue from a sale based on the unit price and quantity of a product input by the user. The discount rate is 10% for the quantity purchased between 100 and 120 units, and 15% for the quantity purchased greater than 120 units. If the quantity purchased is less than 100 units, the discount rate is 0%. See the example output as shown below:

Enter unit price: 25

Enter quantity: 110

The revenue from sale: 2475.0$

After discount: 275.0$(10.0%)

Last updated

Was this helpful?