
tq so much 4 helping me...i really appreciate it... :)... i've another question..n try to do it...
an internet service provider has three different subscription packages for its customers:
package A : for RM9.99 per month 10 hours for access are provided. additional hours are RM2.99 per hour.
package B : for RM19.99 per month 20 hours of access are provided. additional hours are RM1.99 per hour.
package C : for RM29.99 per month unlimited access is provided.
write a program that calculates a customer's monthly bill. it should store the letter of the package that customer has purchased (A,B or C) and the number of hours that were used. the program should display the total charges.
here my coding so far...
import java.util.*; public class MonthlyBill { public static void main (String[]args) { double payrate=0; int hours;
Scanner scan=new Scanner(System.in); System.out.println("Enter customer's name: "); String name=scan.nextLine();
System.out.println("Enter package('A' or 'B' or 'C') : "); String pack=scan.nextLine();
if(pack.equalsIgnoreCase("A")) { payrate=9.99; System.out.println("Enter your customer's hour here:"); int hour=scan.nextInt();
if(hours >= 10) payrate= payrate * 2.99;
} else if(pack.equalsIgnoreCase("B")) { payrate=19.99; System.out.println("Enter your customer's hour here:"); int hour=scan.nextInt();
if(hours >= 20) payrate= payrate * 1.99;
} else if(pack.equalsIgnoreCase("C")) { payrate=29.99; System.out.println ("No extra charge for your additional hours"); System.out.println ("You get unlimited access"); }
System.out.println ("Total monthly bill \n" + payrate);
} }
i think there is so many error...please try check it out..

Hello Friend,
We have modified your code:
import java.util.*;
public class MonthlyBill {
public static void main (String[]args) {
double payrate=0; //int hours=0;
double hr=0;
Scanner scan=new Scanner(System.in);
System.out.println("Enter customer's name: ");
String name=scan.nextLine();
System.out.println("Enter package('A' or 'B' or 'C') : ");
String pack=scan.nextLine();
if(pack.equalsIgnoreCase("A")) {
System.out.println("Enter your customer's hour here:");
double hour=scan.nextDouble();
payrate=9.99;
if(hour >10)
hr = hour - 10;
double ch = hr * 2.99;
payrate = payrate+ ch;
}
else if(pack.equalsIgnoreCase("B")) {
System.out.println("Enter your customer's hour here:");
double hour=scan.nextDouble();
payrate=19.99;
if(hour >20)
hr = hour - 20;
double ch = hr * 1.99;
payrate= payrate +ch;
} else if(pack.equalsIgnoreCase("C")) {
payrate=29.99;
System.out.println("No extra charge for your additional hours");
System.out.println ("You get unlimited access");
}
System.out.println ("Total monthly bill \n" + payrate);
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.