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
The purpose of __________________ is to isolate the behavior of a given component of software. It is an excellent tool for softw
OLga [1]

Answer:

d.) black-box testing

Explanation:

Software testing can be regarded as procedures/process engage in the verification of a system, it helps in detection of failure in the software, then after knowing the defect , then it can be corrected. Black Box Testing can be regarded as a type of software testing method whereby internal structure as well as design of the item under test is not known by one testing it. In this testing internal structure of code/ program is unknown when testing the software, it is very useful in checking functionality of a particular application. Some of the black box testing techniques commonly used are; Equivalence Partitioning, Cause effect graphing as well as Boundary value analysis. It should be noted that the purpose of black-box testing is to isolate the behavior of a given component of software.

3 0
3 years ago
Based on your research and understanding, write a 3- to 4-page Microsoft Word document that:
Over [174]

Answer:

....

Explanation:

3 0
3 years ago
Consider the language defined by the following regular expression. (x*y | zy*)* Does zyyxz belong to the language? Yes, because
Mrrafil [7]

Answer:

Consider the language defined by the following regular expression. (x*y | zy*)* 1. Does zyyxz belong to the language?

O. No, because zyy does not belong to x*y nor zy*

2. Does zyyzy belong to the language?

Yes, because both zy and zyy belong to zy*.

Explanation:

4 0
3 years ago
Which one of the following oscilloscope controls is used to move the trace up and down the screen vertically? A. Focus B. Sweep
irga5000 [103]
The answer is A Focus hope it helps
7 0
3 years ago
Read 2 more answers
Create a Double complementary or tetradic colors (are a set of two complementary pairs of colors that form a rectangle on the co
hjlf

Answer:

(Remember, two colors are complementary if they are opposite each other ... colors are connected on the color wheel they form a rectangle.

Explanation:

best one i could find if worng am verys very sorry.

4 0
3 years ago
Read 2 more answers
Other questions:
  • 6. An art museum owns a large volume of works of art. Each work of art is described by an item code (identifier), title, type, a
    6·1 answer
  • The device used to connect a network to the internet is called a
    7·1 answer
  • Based upon what you know
    5·1 answer
  • The ____________ mechanism consists of a lever arm attached to the mousetrap spring.
    15·1 answer
  • How many address bits are needed to specify each byte in a 512 byte memory unit?
    5·1 answer
  • Which of the following is not considered format?
    8·2 answers
  • Explain the consequences of using bits to represent data.
    10·1 answer
  • How many parameters can we use in each function?
    15·1 answer
  • Is it true that if the user log out the computer will turn off automatically​
    9·2 answers
  • What is the digital revolution and how did it change society?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!