answer.
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
ch4aika [34]
2 years ago
7

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

(): public class CalcMiles { public static void main(String [] args) { double milesPerHour
Computers and Technology
1 answer:
weeeeeb [17]2 years ago
7 0

Complete Question

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

Original main():

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); } }

Answer:

import java.util.Scanner;

public class CalcMiles

{

public double CalculateMiles (double miles, double minutes)

{ //Method CalculateMiles defined above

//Declare required variables.

double hours = 0.0;

double mile = 0.0;

//Calculate the hours travelled and miles travelled.

hours = minutes / 60.0;

mile = hours * miles;

//The total miles travelled in return.

return mile;

}

public static void main(String [] args)

{

double milesPerHour = 70.0;

double minsTravelled = 100.0;

CalculateMiles timetraveles = new CalculateMiles();

System.out.println("Miles: " + timetravels.CalculateMiles(milesPerHour, minsTraveled));

}

}

//End of Program

//Program was written in Java

//Comments are used to explain some lines

Read more on Brainly.com - brainly.com/question/9409412#readmore

You might be interested in
Exercise 3.6.9: 24 vs. "24"5 points
Anton [14]

This is all you need to do for this one add quotes around the number to make it a string. Then for the question I don't know if you need to answer it but I said that when there is only one string it creates and addition problem of 24 + 24 and then when there are two strings it puts them right next to each other making it look like the number 2424.

7 0
2 years ago
In a well-designed detail report, a field called a(n) ____ field controls the output.
Illusion [34]

Answer:

Control

Explanation:

5 0
2 years ago
Given an int variable k, an int array incompletes that has been declared and initialized, an int variable studentID that has bee
Feliz [49]

Answer:

check the explanation

Explanation:

Variables when it comes to programming are used to store data to be documented and manipulated in a computer program. They can also be used for labeling stored data with a descriptive name and any other needed details, so that the programs can be comprehended more understandably by the reader and ourselves.

to solve the question, we will write this set of codes;

numberOfIncompletes = 0;

for(k = 0; k < incompletes.length; k++)

{

       if(incompletes[k] == studentID)

           numberOfIncompletes++;

}

7 0
2 years ago
The best defense against viruses is to install ________ software, which is specifically designed to detect viruses and protect y
saw5 [17]
The best defense against viruses is to install anti-virus software, which is specifically designed to detect viruses and protect your computer and files from harm. Anti-virus software is called also anti-malware software. It is a set of software programs installed on computers with the goal to prevent, to detect and remove viruses. Example for viruses are  worms, trojans, adware and many more.
3 0
2 years ago
Write a program trapezoid.cpp that prints an upside-down trapezoid of given width and height. However, if the input height is im
MatroZZZ [7]

Answer:

#include <iostream>

using namespace std;

int main()

{    

   int rows, width, height, spaces, stars; // declare values

   cout << "enter width" << endl;

   cin >> width;

   cout << "enter height" << endl;

   cin >> height;

   for (int row = 0; row < height; ++row) {

       for (int col = height + row; col > 0; --col) {

           if (height % 6 == 1) {  

               cout << "Impossible shape!" << endl;

               return 0;

           }

           cout << " ";

       }

       for (int col = 0; col < (width - 2 * row); ++col) {

           cout << "*";

           spaces += 1;

           stars -= 2;

       }

       cout << endl;

3 0
2 years ago
Other questions:
  • Represent decimal number 8620 in (a) BCD, (b) excess-3 code, (c)2421 code, and (d) as a binary number
    7·1 answer
  • Carefully choosing from a set of alternatives to accomplish an objective is known as? A. Independence B. Decision making C. Netw
    9·2 answers
  • Consider an application that transmits data at a steady rate (for example, the sender generates an N-bit unit of data every k ti
    8·1 answer
  • Which of the following connects the processor to the chipset and memory on the motherboard? a. Thread b. FSB c. BIOS d. ALU
    9·1 answer
  • Given an alphabet, print all the alphabets up to and including the given alphabet.
    15·2 answers
  • Enter an input statement using the input function at the shell prompt. When the prompt asks you for input, enter a number. Then,
    9·1 answer
  • You are the IT security administrator for a small corporate network. Samuel Garcia (sgarcia) has been away on vacation and has f
    9·1 answer
  • 1. Create a view named customer_addresses that shows the shipping and billing addresses for each customer.
    15·1 answer
  • Write a query to show the price reduced by 10% for all products that are tables or entertainment centers with a standard price g
    10·1 answer
  • HELP 30 points and Brainliest.Type the correct answer in the box. Spell all words correctly.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!