How to make invalid choice appear when you enter a wrong letter in Full Payment and Installment | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make invalid choice appear when you enter a wrong letter in Full Payment and Installment

import java.util.*; public class DecisionStructureSetA{ public static void main(String [] args){ String choice ; double fee = 45000,totalFee,totFee, monthlyFee, quarterlyFee; Scanner scan = new Scanner(System.in); System.out.println("*** TUITION FEE SIMULATION***"); System.out.println("[F] Full Paymaent"); System.out.println("[I] Installment"); System.out.print("Enter choice: "); choice = scan.next(); switch(choice){ case "F": case "f": System.out.println("***FULL PAYMENT***"); System.out.println("[1] Cash"); System.out.println("[2] Cheque"); System.out.print("Enter Choice: "); choice = scan.next(); switch(choice){ case "1": System.out.println("Thanks for paying in cash!"); totalFee = fee * .10; totFee = fee - totalFee; System.out.println("Your tution fee is:" + totFee); break; case "2": System.out.println("Your cheque payment would be clear in three days!"); break; default: System.out.print("Invalid

9th Sep 2018, 1:43 PM
Reginald Tobias
Reginald Tobias - avatar
1 Answer
+ 1
Hit the plus in the circle to link your complete code here. We can't give help with only a piece of it.
9th Sep 2018, 9:08 PM
John Wells
John Wells - avatar