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
dmitriy555 [2]
3 years ago
6

Write a method so that the main() code below can be replaced by the simpler code that calls method mphAndMinutesToMiles(). Origi

nal main():
public class CalcMiles {
public static void main(String [] args) {
double milesPerHour;
double minutesTraveled;
double hoursTraveled;
double milesTraveled;
milesPrHour = scnr.nextDouble();
minutesTraveled = scnr.nextDouble();
hoursTraveled = minutesTraveled / 60.0;
milesTraveled = hoursTraveled * milesPerHour;
System.out.println("Miles: " + milesTraveled);
}
}
import java.util.Scanner;
public class CalcMiles {
/* Your solution goes here */
public static void main(String [] args) {
Scanner scnr = new Scanner(System.in);
double milesPerHour;
double minutesTraveled;
milesPerHour = scnr.nextDouble();
minutesTraveled = scnr.nextDouble();
System.out.println("Miles: " + mphAndMinutesToMiles(milesPerHour, minutesTraveled));
}
}

Computers and Technology
2 answers:
Burka [1]3 years ago
8 0

Answer:

public static double mphAndMinutesToMiles(double m,double t){

return m*t/60;

}

Explanation:

defon3 years ago
5 0

ANSWER

The JAVA program after simplification is as below.

import java.util.Scanner;

public class CalcMiles {

   

   // variables declaration

   static double milesPerHour;

   static double minutesTraveled;      

   static double hoursTraveled;

   static double milesTraveled;

   

   // method declared static

   public static void mphAndMinutesToMiles(double speed, double mins)

   {

       // computations to calculate distance travelled

       hoursTraveled = mins / 60.0;

       milesTraveled = hoursTraveled * speed;

       

       // result displayed on the screen  

     System.out.println("Miles: " + milesTraveled);

   }

   

   // Scanner object created inside main()

   // user input taken inside main()

   public static void main(String [] args)

   {

       Scanner scnr = new Scanner(System.in);

       System.out.println("Enter miles travelled per hour ");

       milesPerHour = scnr.nextDouble();

       System.out.println("Enter minutes required to travel ");

       minutesTraveled = scnr.nextDouble();

       

       mphAndMinutesToMiles(milesPerHour, minutesTraveled);

       

   }

}

OUTPUT

Enter miles travelled per hour  

2.3

Enter minutes required to travel  

1234

Miles: 47.30333333333333

EXPLANATION

The program is simplified as explained below.

1. User input is taken using the object of Scanner class.

2. This object of Scanner class can only be created inside main() method hence, user input can only be taken inside main().

3. The code to calculate the result is separated in another method, mphAndMinutesToMiles(). This method is declared with return type void since no value is returned.

4. After user input is taken in main() for miles travelled per hour and minutes required to travel, these values are passed as parameters to the mphAndMinutesToMiles() method.

5. These parameters are used in calculation part. The total miles travelled in total hours (obtained from minutes), is calculated. The code to display the result is added to this method.

6. Inside the main method, only the code to create Scanner object, code to take user input for two variables and code to call the mphAndMinutesToMiles() is included.

7. The variables are declared as static and declared at class level.

8. No variable is declared inside any of the two methods.

You might be interested in
Intelligence is to creativity as _____ is to _____. Group of answer choices spatial intelligence; musical intelligence correct t
NARA [144]

Answer:

convergent thinking is to divergent thinking.

Explanation:

5 0
3 years ago
A circuit has a resistance of 300 ohm and a current of 0.024 A. What is the voltage in the circuit?
fomenos
**Formula

If u want to calculate voltage:
Current x Resistance

so the answer is D

Current:
Voltage ÷ Resistance

Resistance:
Voltage ÷ Current
7 0
3 years ago
Enables businesses and consumers to share data or use software applications directly from a remote server over the Internet or w
Sindrei [870]

Answer:

Cloud Computing        

Explanation:

Cloud Computing is basically an infrastructure to deliver various computing resources and services  to the users online (via Internet). These resources include networks, applications, servers, databases, software, storage etc.

These services are mostly utilized by organizations for recovery and backup of data, using virtual hardware and other computing resources such as desktops, memory etc. Cloud computing is also used for developing software, for securing data by providing with access control and for storing bulk of data.

The benefits of cloud computing are as following:

Because of cloud computing the customers do not have to buy hardware or install software on their computer which might be very costly to maintain and update. Servers and data centers are provided by cloud service providers and experts are available for managing the services and resources.

These services are scalable and can be adjusted as per the users requirements.

Cloud computing offers a variety of protocols, tools, and access controls that improve security and protects confidential data, applications, and networks against security threats and attacks. It also provides with data backup, disaster recovery.

5 0
3 years ago
Directions for starting the computer and opening a word processor document
aleksandr82 [10.1K]
First you download word after you open a page  and you start 
4 0
3 years ago
In 1-2 pages, identify a social networking technology and identify at least 10 security and/or privacy risks the technology has
algol13

Answer:

One of the biggest social media giants has faced many such security and privacy risks in the past 3 years. 10 are listed below:

1. No one can forget the New Zealand attack on the mosque, and it was telecast live via it. And that is certainly a security risk. And if someone is able to stream live, the AI is in question definitely as this cannot be telecast.

2. Can you forget the various US shooting cases in the past 5 years? And many out of them where telecast lives on it. Again the AI, and the authentication is in question.

3. Many evils have many times advertised itself through it, and that is a security risk. This put up the question on the Data Scientists of the company.

4. It's a huge data on it, and many users have been able to misuse it, and that is a security risk. This put up the question mark on the application of the Big Data.

5. Once, the UK parliament questioned it to sell the secret data, and that was a privacy risk.

6. An Engineer was caught negotiating to sell secret users data to a third party, and that is a privacy risk as well as a question on management technology, as its possible now to check these kind of frauds.

7. Its accounts have been hacked many times, as well as millions of user-profiles, were stolen. This is a security and privacy risk.

8. Its data is still not safe as evils have proved they can break the authentication. However, it has reacted well, and they look like being a safe destination now.

9. Once, someone from Russia was caught collecting a lot of data from it. That was a security and privacy risk. And surely if someone is uploading a lot of complicated and confidential data, must be checked through proper AI implementation.

10. In India too there have been claims that a lot of personal information during elections 2014 was sold. That was a security and data risk. And the data scientists were proved vulnerable again. Its quite sure hence, a lot of work has to be done in Data Science and Artificial intelligence still.

However, its owner is one of the finest souls on earth. He donated all his money when he was blessed with a child. Some out of his team cheated, and else some technology failure or the huge amount of data was the reason for the fault. However, other companies are also facing such problems. And hence, he cannot be blamed for this. And the company now definitely has recovered from the nightmare that they faced in the past 3 years.

Explanation:

The answer is self explanatory.

8 0
3 years ago
Other questions:
  • If you think the user might enter 24.9, you should create a float variable. true or false
    9·1 answer
  • You should use html elements instead of server controls when
    11·1 answer
  • When you want to avoid sending email that a recipient may feel their privacy has been invaded, how would you fill in the (To) bo
    13·1 answer
  • A computerized spreadsheet program is useful for
    6·2 answers
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    7·1 answer
  • I really need this done Thank you!!
    6·1 answer
  • Es costoso construir un robot
    6·1 answer
  • _________ can be used to provide access control, confidentiality, data origin authentication, connectionless integrity, rejectio
    12·1 answer
  • Consider a Huffman’s Algorithm that uses a variable-length encoding scheme to compress the original text: BIRTHDAY to determine
    7·1 answer
  • What option can be used by a system administrator to ensure that dynamic updates are made only by known clients when you have a
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!