Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do i get the - 2 5 % as shown in the example / sample run. Please look at my code and tell me

How do i get the -25% as shown in the example/sample run.
Please look at my code and tell me what I need to change or do. Thanks!
INSTRUCTIONS:
Note that it costs 120.25 dollars per credit hour in addition to $35.00
charged for health and id services. Students with gpa of 3.5 or higher
receive a discount of 25% when the total payments exceed $700.
My Code:
private double calculateTotalPayment(){
double totalPayment =0;
for (Integer crn : listOfCrns){
totalPayment +=120.25;
}
totalPayment +=35.00; // Health & id fees
if (totalPayment >700 && gpa >=3.5){
totalPayment *=0.75; //25% discount
}
return totalPayment;
}
public void printFeeInvoice(){
System.out.println("VALENCE COLLEGE");
System.out.println("ORLANDO FL 10101");
System.out.println("--------------------------");
System.out.println("");
System.out.println("Fee Invoice Prepared For Student: ");
System.out.println(+ studentId +"-"+ studentName);
System.out.println("");
System.out.println("1 Credit Hour = $120.25");
System.out.printf("%-10s%-10s%-10s%-10s
","CRN","CR_PREFIX", "CR_HOURS", "AMOUNT");
double totalPayment =0;
for (Integer crn : listOfCrns){
String prefix = getPrefix(crn);
int creditHours = getCreditHours(crn);
double amount = creditHours *120.25;
totalPayment += amount;
System.out.printf("%-10d%-10s%-10d$%-10.2f
", crn, prefix, creditHours, amount);
}
System.out.println("\t\t\tHealth & id fees $ 35.00");
System.out.println("------------------------------");
System.out.printf("%-10s$%-10.2f
","\t\t\tTotal Payments", totalPayment +35);
}VALENCE COLLEGE
ORLANDO FL 10101
Fee Invoice Prepared for Student:
5959-DANIEL TAZI
1 Credit Hour =$120.25
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Privacy In Statistical Databases International Conference Psd 2022 Paris France September 21 23 2022 Proceedings Lncs 13463

Authors: Josep Domingo-Ferrer ,Maryline Laurent

1st Edition

3031139445, 978-3031139444

More Books

Students also viewed these Databases questions