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
marta [7]
3 years ago
11

Write a method so that the main() code below can be replaced by simpler code that calls method calcMilesTraveled(). Original mai

n():
public class CalcMiles {
public static void main(String [] args) {
double milesPerHour = 70.0;
double minutesTraveled = 100.0;
double hoursTraveled;
double milesTraveled;
hoursTraveled = minutesTraveled / 60.0;
milesTraveled = hoursTraveled * milesPerHour;
System.out.println("Miles: " + milesTraveled);
}
}
1 import java.util.Scanner;
2
3 public class CalcMiles (
4
5 /" Your solution goes here ./
6 private double calcMilesTraveled(double milesPertour, double ninsTraveled)
7 double hoursTraveled
8 double milesTraveled;
9
10 hoursTraveled mibsTraveled 60.8
11 milesTraveled hoursTraveled milesperhour
12
13 return milesTraveled;
14
15
16 public static void main(String 0] args)
17 double milesPerhour 70.0;
18 double minutesTraveled 100.0
19
20 System.out.printin("Miles: mphAndMinutesToMiles(milesPerHour, minutesTraveled))i
Computers and Technology
1 answer:
patriot [66]3 years ago
5 0

Answer:

See explanation

Explanation:

From the question, you have answered the question. However, it is poorly formatted.

<em>So, I'll help present the code properly and also give explanation using comments.</em>

import java.util.Scanner;

public class CalcMiles{

//This line defines the calcMilesTraveled method

private static double calcMilesTraveled(double milesPerhour, double minsTraveled){

//This declares hoursTraveled

double hoursTraveled;

//This declares milesTraveled

double milesTraveled;

<em>//This calculates the hoursTraveled</em>

hoursTraveled = minsTraveled/60.0;

//This calculates the milesTraveled

milesTraveled = hoursTraveled * milesPerhour;

//This returns the milesTraveled

return milesTraveled;

}

//The main method begins here

public static void main(String [] args){

//This declares and initializes milesPerhour

double milesPerhour =70.0;

//This declares and initializes minutesTraveled

double minutesTraveled = 100.0;

//This calls the calcMilesTraveled function and also prints the required result

System.out.println("Miles: "+calcMilesTraveled(milesPerhour, minutesTraveled));

}

}

<em>See attachment for program without comments</em>

Download txt
You might be interested in
Whereas enterprise network convergence focuses on the consolidation of traditionally distinct voice, video, and data communicati
Vinil7 [7]

Answer: Unified communication

Explanation: Unified communication is the communication technique in which merges various communication routines into a individual business.It works as the phone system which helps in increment of productivity in an organizational business.

The unifying of voice,data/information,video etc is done for optimizing and improving the business that also results in  faster communication rates, secure communication etc.

4 0
3 years ago
Describe the Order of Operations in Java programming.
cestrela7 [59]

Answer:

It stands for Parentheses, Exponents, Multiplication/Division, Addition/Subtraction. PEMDAS is often expanded to the mnemonic "Please Excuse My Dear Aunt Sally" in schools. Canada and New Zealand use BEDMAS, standing for Brackets, Exponents, Division/Multiplication, Addition/Subtraction.

5 0
3 years ago
Materials such as copper, silver, and aluminum through which electric energy passes freely are called
nasty-shy [4]
These materials are called conductors
6 0
3 years ago
How are sorting tools helpful for using spreadsheets and databases? Sorting tools let you locate information by searching for na
Black_prince [1.1K]

Answer:

Sorting tools allow you to organize data into columns and rows that help you locate what you are looking for.

Explanation:

Spreadsheet applications and relational databases are similar in configuration as they are both arranged in rows and columns (tabular). Sorting a spreadsheet or database is useful as it helps to organize data. A sorted spreadsheet or database can be in ascending or descending order which makes it easier and faster to locate rows of data manually or by query.

7 0
3 years ago
Read 2 more answers
The case states that google intended the limited initial rollout to be a beta test of google glass, meaning that the adopters we
tigry1 [53]

Google intended the limited initial rollout to be a test of google glass, that the adopters were Innovators. The initial rollout of Google Glass was limited, purposefully so as to set the price very high. This mean that only a selected few, and those with plenty of disposable income, would be the first to use these devices. Google required people to register for the chance to receive a set. Even if many would want to spend the money on these devices, Google allowed only a selected few to receive them.

7 0
3 years ago
Other questions:
  • Please help!
    6·2 answers
  • What type of authentication does the dod require to access sensitive data on mobile devices and/or e-mail?
    9·1 answer
  • Getting access to web browsing software to install it on a computer or to update your existing software is called _________ .
    9·2 answers
  • An instruction book or program that takes users through a prescribed series of steps to learn how to use a program is called (a)
    10·1 answer
  • A(n) ____ string contacts the data source and establishes a connection with the database using the Data Source Configuration Wiz
    5·1 answer
  • In a relational database, the three basic operations used to develop useful sets of data are:_________.
    14·1 answer
  • 9. Which of the following is the<br>leading use of computer?​
    13·1 answer
  • Example of Not a computer characteristics example
    12·1 answer
  • Please what do you guys think about this ?
    10·2 answers
  • Which version of java should i use?.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!