Redraw the flowchart of the cellphone so that it uses the following methods to calculate the billing amount. (do not output the number of minutes during which the service is used.)
a. regularBill: This method calculates and returns the billing amount for regular
service.
b. premiumBill: This method calculates and returns the billing amount for premium
service.
import java.util.Scanner;
public class Main
{
static void regularBill(){
Scanner input=new Scanner(System.in);
System.out.print("\n\nEnter the initial price: ");
double p=input.nextDouble();
double x=0.2*p;
double y=p-x;
System.out.println("Billing amount for regular service is: "+y);
}
static void premiumBill(){
Scanner input=new Scanner(System.in);
System.out.print("\nEnter the price: ");
double M=input.nextDouble();
double Rate=0.3*M;
System.out.println("The billing amount for premium service is: "+Rate);
}
public static void main(String[] args) {
System.out.print("Regular Billing");
regularBill();
System.out.print("\npremium Billing");
premiumBill();
}
}
Comments
Leave a comment