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
14. In cell B14, create a formula without using a function that adds 1 to the value in cell B12 and then multiplies the result b
vagabundo [1.1K]

Answer:

The formula for the given problem is given below:

= (1+B$12)×B13

Explanation:

Immediately you do one, then you can autofill the formula to the mentioned range B15:B17 and then to C14 to H17

When been done correctly, this is how the formula will look in those cells if you do it correctly.

Check the file attached below to see it.

7 0
3 years ago
You are setting up your Windows computer to connect to the Internet and notice that when you type www.microsoft, the browser doe
Harrizon [31]

Answer:

Check your DNS settings

Explanation:

Different errors may occur when setting up your computer to connect to the internet, one of which is described in the question above.

The DNS (Domain Name System) is responsible for redirecting domain names to their physical IP address. Instead of remembering every IP address of sites you visit frequently, domain names are used for easy remembrance, the DNS makes the matching of domain names to IP addresses possible.

To change your DNS setting follow these steps:

  1. Click settings from your start menu
  2. Click on Network and Internet
  3. Look to the bottom of the main page and click on "Network and Sharing Center"
  4. On the left tab, click "Change adapter settings"
  5. Right Click on the current network you are using and select properties
  6. Left-click on the "Internet Protocol Version 4 (TCP/IPv4) and click on properties.
  7. Check to see if "Obtain DNS server address automatically" is selected, if it is selected,
  8. Click on the radio button under it "Use the following DNS server address"
  9. Enter the DNS address you want to use
  10. Click Ok and close the window.

The problem should be resolved.

4 0
3 years ago
What are your thoughts on the last nintendo direct
allsm [11]

Answer:

I don't know? How do you feel about them?

Explanation:

5 0
3 years ago
Read 2 more answers
9. A change in the appearance of a value or label in a cell
alexandr402 [8]

Answer:

format

alignment

excel

=

Explanation: i'm an accountant

4 0
3 years ago
Plz I need help 30 points
Kisachek [45]

hey mate your ans

in the picture

8 0
3 years ago
Other questions:
  • Question 4 (2 points)
    6·2 answers
  • Design and implement an application that reads a sequence of up to 25 pairs of names and postal (ZIP) codes for individuals. Sto
    9·1 answer
  • If K is a foreign key in relation R1, then
    10·1 answer
  • Which model emphasizes the risk analysis phase of development
    12·1 answer
  • Justin signed a rental agreement for his new condo. How long is his lease? a p e x
    15·1 answer
  • What can your employer do to protect you from overhead power lines?
    13·1 answer
  • 6, Answer the following questions.0<br>a What is software?​
    5·1 answer
  • Lesson 2.7 Code Practice #2
    13·1 answer
  • The __________ statement allows you to check for
    7·1 answer
  • How does information promote cooperation and Industry please explain​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!