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
Leona [35]
2 years ago
5

Malcolm Movers charges a base rate of $200 per move plus $150 per hour and $2 per mile. Write a program named MoveEstimator that

prompts a user for and accepts estimates for the number of hours for a job and the number of miles involved in the move and displays the total moving fee. For example, if 25 hours and 55 miles are input the output would be displayed as: For a move taking 25 hours and going 55 miles the estimate is $4,060.00
Computers and Technology
1 answer:
jeka942 years ago
6 0

Answer:

import java.util.Scanner;

public class MoveEstimator

{

public static void main(String[] args) {

   

    Scanner input = new Scanner(System.in);

    final int BASE_RATE = 200, RATE_PER_HOUR = 150, RATE_PER_MILE = 2;

    int hours, miles;

    double totalFee = 0.0;

   

 System.out.print("Enter the number of hours for a job: ");

 hours = input.nextInt();

 System.out.print("Enter the number of miles: ");

 miles = input.nextInt();

 

 totalFee = BASE_RATE + (hours * RATE_PER_HOUR) + (miles * RATE_PER_MILE);

 System.out.printf("For a move taking %d hours and going %d miles the estimate is $%.2f", hours, miles, totalFee);

}

}

Explanation:

*The code is in Java.

Create the Scanner object to be able to get input

Initialize the constant values using final keyword, BASE_RATE, RATE_PER_HOUR, RATE_PER_MILE

Declare the variables, hours, miles, totalFee

Ask the user to enter the hours and miles

Calculate the totalFee, add BASE_RATE, multiplication of  hours and RATE_PER_HOUR, multiplication of  miles and RATE_PER_MILE

Print the output as in required format

You might be interested in
Given an array as follows
slava [35]

Answer:

1) Method calcTotal:

  1. public static long calcTotal(long [][] arr2D){
  2.        long total = 0;
  3.        
  4.        for(int i = 0; i < arr2D.length; i++ )
  5.        {
  6.            for(int j = 0; j < arr2D[i].length; j++)
  7.            {
  8.                total = total + arr2D[i][j];
  9.            }
  10.        }
  11.        
  12.        return total;
  13.    }

Explanation:

Line 1: Define a public method <em>calcTotal</em> and this method accept a two-dimensional array

Line 2: Declare a variable, total, and initialize it with zero.

Line 4: An outer for-loop to iterate through every rows of the two-dimensional array

Line 6: An inner  for-loop to iterate though every columns within a particular row.

Line 8: Within the inner for-loop, use current row and column index, i and j, to repeatedly extract the value of each element in the array and add it to the variable total.

Line 12: Return the final total of all the element values as an output

Answer:

2) Method calcAverage:

  1. public static double calcAverage(long [][] arr2D){
  2.        double total = 0;
  3.        int count = 0;
  4.        
  5.        for(int i = 0; i < arr2D.length; i++ )
  6.        {
  7.            for(int j = 0; j < arr2D[i].length; j++)
  8.            {
  9.                total = total + arr2D[i][j];
  10.                count++;
  11.            }
  12.            
  13.        }
  14.        
  15.        double average = total / count;
  16.        
  17.        return average;
  18.    }

Explanation:

The code in method <em>calcAverage</em> is quite similar to method <em>calcTotal</em>. We just need to add a counter and use that counter as a divisor of total values to obtain an average.

Line 4: Declare a variable, count, as an counter and initialize it to zero.

Line 11: Whenever an element of the 2D array is added to the total, the count is incremented by one. By doing so, we can get the total number of elements that exist in the array.

Line 16: Use the count as a divisor to the total to get average

Line 18: Return the average of all the values in the array as an output.

Answer:

3) calcRowAverage:

  1. public static double calcRowAverage(long [][] arr2D, int row){
  2.        double total = 0;
  3.        int count = 0;
  4.        
  5.        for(int i = 0; i < arr2D.length; i++ )
  6.        {
  7.            if(i == row)
  8.            {
  9.                for(int j = 0; j < arr2D[i].length; j++)
  10.                {
  11.                    total = total + arr2D[i][j];
  12.                    count++;
  13.                }
  14.            }
  15.            
  16.        }
  17.        
  18.        double average = total / count;
  19.        
  20.        return average;
  21.    }

Explanation:

By using method <em>calcAverage </em>as a foundation, add one more parameter, row, in the method <em>calcRowAverage</em>. The row number is used as an conditional checking criteria to ensure only that particular row of elements will be summed up and divided by the counter to get an average of that row.

Line 1: Add one more parameter, row,

Line 8-15: Check if current row index, i, is equal to the target row number, proceed to sum up the array element in that particular row and increment the counter.

5 0
3 years ago
Hot components or sharp edges of computer is an example of what hazard​
Alexxandr [17]

Answer:

hot components or sharp edges of computer is an example of a mechanical hazard

6 0
2 years ago
To make the most informed purchasing decision, you should:
musickatia [10]

Answer:

its either A or B but im leaning more towards B

Explanation:

6 0
2 years ago
The 6 steps for PowerPoint competency from the TED talk in the module "How to Avoid Death by PowerPoint."?
KIM [24]

Answer:

1. Do some presentation preparation work

2. Set the right tone and end on a high note.

3. Create sleek and stylish slides.

4. Get your audience to focus.

5. Its all about you.

Explanation:

1. Do some presentation preparation work:

A good presentation begins, not with slides, but with a pencil and paper. Research your audience’s background, interests and capabilities. What do they already know, for instance, and what can they learn from you?

2. Set the right tone and end on a high note:

You have no more than 30 seconds to secure your audience’s attention. So, what attention-grabbing opener will you use?

Visual communications expert Curtis Newbold suggests “a fascinating quote; an alarming or surprising statistic; asking your audience a question; telling a relevant and funny joke… an imaginary scenario; or a demonstration''.

3. Create sleek and stylish slides:

Once you have your story down, you can start to design your slides.  

Before you do, it’s important to think about the practicalities. Will they, for instance, be displayed Widescreen with a 16:9 ratio? Or Standard with 4:3? This might seem like a small detail, but it can make a huge difference in terms of visual impact.

4.  Get your audience to focus:

The most important thing is to grab your audience’s attention straight away – and then maintain it! You want your audience to go away having learned something. So, make it as easy as possible for people to grasp your message “from the off”!

5.  Its all about you:

Finally, remember that, ultimately, it’s you that the audience should be paying attention to, not your slides!

PowerPoint can be used to create great visual aids, but the success of your presentation is determined by the way you deliver them. So, tell your story with a confident, compelling physical presence, and master it by rehearsing it 10 to 15 times.

6 0
3 years ago
The Operating System provides utility software designed to perform specific tasks. What task(s) does it perform? Select all that
viktelen [127]

Answer:

All of the above.

Explanation:

An operating system is a system software pre-installed on a computing device to manage or control software application, computer hardware and user processes.

This ultimately implies that, an operating system acts as an interface or intermediary between the computer end user and the hardware portion of the computer system (computer hardware) in the processing and execution of instructions.

Some examples of an operating system on computers are QNX, Linux, OpenVMS, MacOS, Microsoft windows, IBM, Solaris, VM etc.

Hence, the operating system (OS) provides utility software designed to perform specific tasks. Some of the tasks it performs are;

A. Establishing an Internet connection.

B. Coordinating tasks between programs.

C. Configuring peripheral devices.

D. Monitoring security.

7 0
2 years ago
Other questions:
  • Spreadsheet software creates a ____, composed of a grid of columns and rows
    5·1 answer
  • Search engines that search other search engines are called
    12·2 answers
  • 1. In the.js file, write the JavaScript code for this application. Within the click event handlers for the elements in the sideb
    14·1 answer
  • Why would a designer choose to use an isometric sketch rather than a perspective sketch to share their idea with a design team m
    14·1 answer
  • Solve the following equations and check your result 1) 3x=2x+18​
    5·2 answers
  • As an improvement of the ATX form factor over AT, shorter wires made it easier to shield them and made them capable of handling
    6·1 answer
  • which of the following is a component of a rope-rewind starter system? a. a recoil spring c. an air vane governor b. a wrist pin
    5·1 answer
  • It is impossible to use a computer without a mouse. Is this statement true or false?
    10·1 answer
  • Anyone here play osu! ?
    11·2 answers
  • Set of general format used to write program in any programming language?​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!