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
tekilochka [14]
2 years ago
5

Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). O

riginal main():
int main() {
double milesPerHour;
double minutesTraveled;
double hoursTraveled;
double milesTraveled;

cin >> milesPerHour;
cin >> minutesTraveled;

hoursTraveled = minutesTraveled / 60.0;
milesTraveled = hoursTraveled * milesPerHour;
cout << "Miles: " << milesTraveled << endl; return 0;
}
#include
using namespace std;
//please write your answer here.
int main() {
double milesPerHour;
double minutesTraveled;

cin >> milesPerHour;
cin >> minutesTraveled;

cout << "Miles: " << MphAndMinutesToMiles(milesPerHour, minutesTraveled) << endl;
return 0;
}
Computers and Technology
1 answer:
babymother [125]2 years ago
6 0

Answer:

The program to this question can be given as:

Program:

#include <iostream> //header file

using namespace std; //using namespace

double MphAndMinutesToMiles(double milesPerHour, double minutesTraveled) //defining method

{

return (minutesTraveled/ 60.0)*milesPerHour; //return value.

}

int main() //defining main method

{

double milesPerHour,minutesTraveled; //define variable

cout<<"Enter miles per hour :";  

cin >> milesPerHour;  

cout<<"Enter travelling minutes :";

cin >> minutesTraveled;

cout << "Miles: "<< MphAndMinutesToMiles(milesPerHour, minutesTraveled)<< endl;

return 0;

}

Output:

Enter miles per hour :12

Enter travelling minutes :20

Miles: 4

Explanation:

The explanation of the above C++ program can be given as:

  • In the first header file is include the function is define that is "MphAndMinutesToMiles". This function accepts two parameters that are "milesPerHour and minutesTraveled".
  • Both parameter datatype is double and the function return type is also double. Inside a function calculate miles and return its value.
  • In the main method, two variable defines that takes value from the user side and pass into the function. To print function return value we use "cout" function that prints function return value.
You might be interested in
Write the definition of a class Telephone. The class has no constructors, one instance variable of type String called number, an
balu736 [363]

Answer:

The definition of a class Telephone is given as  

public class Telephone // class telephone

{

String number; // variable  number of type string

static int quantity = 250; // variable  quantity  of type int

static double total = 1565.92;  // variable  total  of type double

}

Explanation:

Following is the description of Statement

  • Create a class "Telephone" by using the keyword class.In that class we declared data member .
  • We declared a variable "number" of type "string" which has no constructor.
  • We declared a variable  "quantity" of type "int" which is a static type variable. The static type variable retains the value during the program execution.
  • We declared a variable  "total" of type "double" which is a static type variable. The static type variable retain the value during the program execution .
5 0
2 years ago
JAVA Write a program that first asks the user to type a letter grade and then translates the letter grade into a number grade. L
ale4655 [162]

Answer:

Follows are the code to this question:

import java.util.*;//import package for user input

class GradePrinter//defining class GradePrinter

{

double numericValue = 0;//defining double variable

String grade = "";//defining String variable

GradePrinter()//defining default constructor  

{

Scanner xb = new Scanner(System. in );//defining Scanner  class object

System.out.print("Enter Grade: ");//print message

grade = xb.nextLine();//input string value  

}

double getNumericGrade()//defining double method getNumericGrade

{

if (grade.equals("A+") || grade.equals("A"))//defining if block that check input is A+ or A

{

numericValue = 4.0;//using  numericValue variable that hold float value 4.0

}

else if (grade.equals("A-"))//defining else if that check grade equals to A-

{

numericValue = 3.7;//using  numericValue variable that hold float value 3.7

}

else if (grade.equals("B+"))//defining else if that check grade equals to B-

{

numericValue = 3.3;//using  numericValue variable that hold float value 3.3

}

else if (grade.equals("B"))//defining else if that check grade equals to B

{

numericValue = 3.0;//using  numericValue variable that hold float value 3.0

}

else if (grade.equals("B-"))//defining else if that check grade equals to B-  

{

numericValue = 2.7;//using  numericValue variable that hold float value 2.7

}

else if (grade.equals("C+"))//defining else if that check grade equals to C+  

{

numericValue = 2.3; //using  numericValue variable that hold float value 2.3

}

else if (grade.equals("C")) //defining else if that check grade equals to C  

{

numericValue = 2.0; //using numericValue variable that hold float value 2.0

}

else if (grade.equals("C-")) //defining else if that check grade equals to C-  

{

numericValue = 1.7;//using umericValue variable that hold float value 1.7

}

else if (grade.equals("D+"))//defining else if that check grade equals to D+  

{

numericValue = 1.3;//using umericValue variable that hold float value 1.3

}

else if (grade.equals("D"))//defining else if that check grade equals to D

{

numericValue = 1.0;//using umericValue variable that hold float value 1.0

}

else if (grade.equals("F"))//defining else if that check grade equals to F

{

numericValue = 0;//using umericValue variable that hold value 0

}

else//defining else block

{

System.out.println("Letter not in grading system");//print message

}

return numericValue;//return numericValue

}

}

class Main//defining a class main

{

public static void main(String[] args)//defining main method

{

GradePrinter ob = new GradePrinter();// creating class GradePrinter object

double numericGrade = ob.getNumericGrade();//defining double variable numericGrade that holds method Value

System.out.println("Numeric Value: "+numericGrade); //print Value numericgrade.

}

}

Output:

Enter Grade: B

Numeric Value: 3.0

Explanation:

In the above-given code, a class "GradePrinter" is defined inside the class a string, and double variable "grade and numericValue" is defined, in which the grade variable is used for input string value from the user end.

After input, the sting value a method getNumericGrade is defined, which uses multiple conditional statements is used, which holds double value in the which is defined in the question.

In the main class, the "GradePrinter" object is created and defines a double variable "numericGrade", that calling method and store its value, and also use print method to print its value.

4 0
2 years ago
A small e-commerce company uses a series of Robotic Process Automation solutions to manage the backup of data from individual wo
Vaselesa [24]

Answer:

Cloud.

Explanation:

Cloud computing can be defined as a form of data computing which requires the use of shared computing resources such as cloud storage (data storage), servers, computer power, and software over the internet rather than local servers and hard drives.

Generally, cloud computing offer individuals and businesses a fast, secured, effective and efficient way of providing services over the internet.

Basically, cloud computing comprises three (3) service models and these include;

1. Platform as a Service (PaaS).

2. Software as a Service (SaaS).

3. Infrastructure as a Service (IaaS).

Additionally, the two (2) main characteristics of cloud computing are;

I. Measured service: it allows cloud service providers to monitor and measure the level of service used by various clients with respect to subscriptions.

II. Resource pooling: this allows cloud service providers to serve multiple customers or clients with services that are scalable and provisional.

For example, the provisioning of On-demand computing resources such as storage, network, virtual machines (VMs), etc., so as to enable the end users install various software applications, database and servers.

Hence, the technology that could be combined by the small e-commerce company with its current automated processes is cloud storage.

9 0
1 year ago
If a user was complaining about a "slow computer" due to a program that uses a significant amount of memory, what part or parts
Sedaia [141]

Answer:

The Random-Access Memory (RAM) should be upgraded.

Explanation:

Since the particuar apllication is taking alot of memory space it means that an ugrade/ installation of a bigger RAM would help the system work better while using the program

6 0
1 year ago
An aviation tracking system maintains flight records for equipment and personnel. The system is a critical command and control s
sergeinik [125]

Answer:

offline backup solution

Explanation:

In such a scenario, the best option would be an offline backup solution. This is basically a local and offline server that holds all of the flight record data that the cloud platform has. This offline backup server would be updated frequently so that the data is always up to date. These servers would be owned by the aviation company and would be a secondary solution for the company in case that the cloud platform fails or the company cannot connect to the cloud service for whatever reason. Being offline allows the company to access the database regardless of internet connectivity.

5 0
1 year ago
Other questions:
  • Instructions:Type the correct answer in the box. Spell all words correctly.
    5·2 answers
  • Match each function with its possible output.
    7·2 answers
  • Which computer applications can Mr. Crowell use to make the classroom learning more stimulating and interesting? Mr. Crowell has
    9·2 answers
  • Suppose that a 10-mb file is stored on a disk on the same track (track 50) in consecutive sectors. the disk arm is currently sit
    13·1 answer
  • Escribe, en los siguientes cuadros, los conceptos que correspondan
    10·1 answer
  • Develop an sec (single error correction) code for a 16-bit data word. generate the code for the data word 0101000000111001. show
    7·2 answers
  • A Color class has a method getColorName that returns a string corresponding to the common name for the color, e.g., yellow, blue
    11·1 answer
  • #Write a function called fancy_find. fancy_find should have #two parameters: search_within and search_for. # #fancy_find should
    9·1 answer
  • The dealer's cost of a car is 85% of the listed price. The dealer would accept any offer that is at least $500 over the dealer's
    7·1 answer
  • A drive is small enough to be carried in one's pocket.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!