Answer to Question #257074 in Computer Networks for Swati singh chauha

Question #257074

Write a program to calculate an Internet browsing bill. Use the conditions specified as follows:

1 hour-Rs 40

½ hour- Rs 20

For unlimited hours in a day- Rs 200

The owner should enter the number of hours spent on browsing.


1
Expert's answer
2021-10-27T01:49:31-0400
import java.util.Scanner;

public class InternetBillCalcuation {

    public static void main(String[] args){
    
        float bill,spentHour;
        
        Scanner sc=new Scanner(System.in);
        
        
        
        
        System.out.println("Please enter the number of hour");
        spentHour=sc.nextFloat();
        System.out.println("Total number of hour spent in browsing:"+spentHour);
        
        if(spentHour>1){
            bill=40*spentHour;
        
        }else{
            bill=20*spentHour;
        }
        System.out.println("The internet bill is :"+bill);
        
        
    }
}

Output:




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS