1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
OleMash [197]
3 years ago
11

Write a program that calculates the cost of a phone call. The user enters a positive integer that

Computers and Technology
1 answer:
san4es73 [151]3 years ago
5 0
Add the following constants in the class definition, before the main method:

    private final static float START_COST = 1.5f;
    private final static float HIGH_TARIFF = 0.5f;
    private final static float LOW_TARIFF = 0.25f;
    private final static int FIXED_MINS = 2;
    private final static int HIGH_TARIFF_MINS = 10;

Then add this to the main method you already had:

        float price = START_COST;
        if (x > FIXED_MINS) {
            if (x <= HIGH_TARIFF_MINS) {
                price += HIGH_TARIFF*(x-FIXED_MINS);
            }
            else {
                price += HIGH_TARIFF*(HIGH_TARIFF_MINS-FIXED_MINS) 
                    + LOW_TARIFF*(x-HIGH_TARIFF_MINS);
            }
        }   
        System.out.printf("A %d minute call costs %.2f", x, price);      

You might be interested in
Can anyone help me ?
IrinaVladis [17]

Answer:

System.out.printIn("Hello, world" );

Its " ); " and not " ) ; "

5 0
1 year ago
_________ is a hybrid cryptosystem that combines some of the best available cryptographic algorithms and has become the open-sou
Maurinko [17]

Answer:

The correct answer is PGP i.e  "Pretty Good Privacy" .

Explanation:

Pretty Good Privacy is an encryption algorithm that gives the database interaction with the confidentiality and authorization.Pretty Good Privacy is security algorithm which gives the security into the mail . login ,decryption ,encryption are the example of the "Pretty Good Privacy" .

Pretty Good Privacy  is a type of  hybrid cryptosystem that incorporates cryptographic algorithms and it has de facto open source standard for the mail and the file storage .

3 0
3 years ago
What computer has special software that allows it to deliver web pages to the Internet?
Vlad1618 [11]
Web browser (Google Chrome, Safari, Internet Explorer, Edge, etc. )
3 0
3 years ago
Read 2 more answers
What is meant by slide rule?​
OleMash [197]

Answer:

a manual device used for calculation that consists in its simple form of a ruler and a movable middle piece which are graduated with similar logarithmic scales.

Explanation:

^

5 0
2 years ago
A graphic on-screen image representing an object or an idea is called a(n) A. menu. B. image. C. graphic. D. icon.
kap26 [50]
It's called D. icon
We often see these icons on our desktop page as soon as we logged on to our personal computer.
The icon on the destkop will acted as a short-cut that will opened up and connected us with the program simply by clicking the icon.
8 0
3 years ago
Read 2 more answers
Other questions:
  • Your computer has two basic types of software: system software and ________ software.
    9·1 answer
  • Is anyone else experiencing the wording::nonifacation::glitch about the "5 hours ago" thingy to whenever you answer a question o
    7·2 answers
  • ________ employees state-of-the-art computer software and hardware to help people work better together.
    15·1 answer
  • Your network has had long power outages that have caused Hyper-V servers to shut down after the UPS battery is drained. When pow
    8·1 answer
  • Which item converts a high level language program to low level machine instruction?
    5·1 answer
  • Select the correct answer from each drop-down menu.
    6·1 answer
  • If a computer is not working properly,the best thing to do is ________?
    5·2 answers
  • An organization is using Amazon CloudWatch Logs with agents deployed on its Linux Amazon EC2 instances.
    7·1 answer
  • Clearing the computer's cache helps store recently-used information.
    8·1 answer
  • ANWSER ASAP
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!