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
Do You assign the Needs Met rating before assigning the page quality (PQ) rating?
tensa zangetsu [6.8K]
IS GOD REAL.......................?<span>

</span>
6 0
3 years ago
How to work a computer cause i don't know how to
VladimirAG [237]

Answer:

power on, connect to internet, download games

6 0
3 years ago
Kate works for a film production company. One of her responsibilities includes handling the technical aspects of the camerawork
Katyanochek1 [597]

Answer:

cinematographer

Explanation:

Kate handles the technical aspects of the camerawork. The keyword is technical aspects. Therefore, she is more of a cinematographer than a camera operator. They sound like they can be interchanged, but not necessarily. The difference between the two roles is that a camera operator is more familiar with the camera equipment and is responsible for creating a plan of execution that requires technical skills. A Cinematographer, on the other hand, relies on the camera operator to film the shots. He/she is in charge of the actual shooting and is the one who decides on the aspects of how to light the scene or how the shot will be composed.

7 0
2 years ago
Consider the following code example:
yKpoI14uk [10]

Answer:

The number of invoices for each vendor that have a larger balance due than the average balance due for all invoices.

Explanation:

This part of the code below

WHERE InvoiceTotal - PaymentTotal - CreditTotal >

(SELECT AVG (InvoiceTotal - PaymentTotal- CreditTotal)

FROM Invoices)

gives the condition to pick the invoices with balance that are greater than the average balance for all invoice.

This part of the code below

GROUP BY VendorName

ORDER BY BalanceDue DESC;

then enables the program to group the result of the above condition by VendorName and sort the resulting rows in the order of BalanceDue. You will therefore, obtain for each row in the NumberOfInvoices column, the number of invoices for each vendor that have a larger balance due than the average balance due for all invoices.

7 0
3 years ago
John was teaching his students about the basics of computer hardware and software. By the end of his lecture, he asked his class
vredina [299]
A CPU is the electronic circuitry within a computer that carries out the instructions of a computer program by performing basic arithmetic logical, control and input/output operations specified by the instructions.
Knowing this, the answer is both C - That it coordinates the flow of instructions and data within computers, And A - That a control unit performs arithmetical and logical computations.
If you can only select one answer, I'd personally go with A.
4 0
3 years ago
Read 2 more answers
Other questions:
  • What is TCP/IP's Transport layer's primary duty?
    8·1 answer
  • What is the benefit of a cloud computing infrastructure? ○ Companies have full control over the data that is hosted. ○ Companies
    11·1 answer
  • What sends massive amounts of email to a specific person or system that can cause that user's server to stop functioning? mail b
    6·1 answer
  • Is downloading like installing?
    13·1 answer
  • Which type of virus includes protective code that prevents outside examination of critical elements?
    14·1 answer
  • Given N lines of input, print the 3rd character from each line as a new line of output. It is guaranteed that each of the n line
    8·1 answer
  • This is a tableware use to serve the main dish
    11·1 answer
  • What makes you normally visit the site-graphics, layout, or content? Why?​
    8·2 answers
  • How can the two independent clauses below be combined to form a correct complete sentence? Check all that apply.
    5·1 answer
  • which of the following statements about the evolving relationship between traditional newspaper operations and blogging is true?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!