Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class StudentGrade {
- public static void main(String[] args) {
- char category;
- double tc, cpu;
- double bill=0.0;
- Scanner scanner;
- scanner = new Scanner(System.in);
- System.out.println("Enter category: ");
- category = scanner.next().charAt(0);
- System.out.println("Enter total used: ");
- tc = scanner.nextDouble();
- switch (category) {
- case 'A':
- if(tc>600){ bill+=(tc-600)*9.98; tc=600;}
- if(tc>400){ bill+=(tc-400)*8.70; tc=400;}
- if(tc>300){ bill+=(tc-300)*5.63; tc=300;}
- if(tc>200){ bill+=(tc-200)*5.36; tc=200;}
- if(tc>75){ bill+=(tc-75)*5.14; tc=75;}
- bill+=(tc*3.80);
- bill+= (20*bill)/100;
- break;
- case 'B':
- bill += (tc*3.82);
- break;
- case 'C':
- char type;
- System.out.println("Enter type: ");
- type = scanner.next().charAt(0);
- switch(type){
- case 'A':
- bill += (tc*7.66);
- break;
- case 'B':
- bill += (tc*6.90);
- break;
- case 'C':
- bill += (tc*9.24);
- break;
- }
- break;
- }
- System.out.println("Total bill: "+bill);
- }
- }
Add Comment
Please, Sign In to add comment