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
Temka [501]
2 years ago
11

Driving is expensive. Write a program with two inputs, a car's miles/gallon and the cost of gas/gallon both represented as doubl

e variables, and output the total drive cost for 10 miles, 50 miles, and 400 miles, all on the same line, each separated by a single space.
Output each floating-point value with two digits after the decimal point, which can be achieved by executing the command
cout << fixed << setprecision(2); once before all other cout statements. That is done only once in the code before any cout stamtent.

Ps:(when i run the program it says this-
Enter miles per Gallon:
Gas cost for ten miles :-nan
Gas cost for fifty miles :-nan
Gas cost for four hundred miles:-nan
Computers and Technology
1 answer:
Nataly_w [17]2 years ago
6 0

Answer:33

Explanation:

You might be interested in
Define Rule Of Thirds
Katena32 [7]

Answer:

In photography, the rule of thirds is a type of composition in which an image is divided evenly into thirds, both horizontally and vertically, and the subject of the image is placed at the intersection of those dividing lines, or along one of the lines itself.

6 0
2 years ago
Develop a C program that calculates the final score and the average score for a student from his/her (1)class participation, (2)
Ghella [55]

Answer:

#include <iomanip>

#include<iostream>

using namespace std;

int main(){

char name[100];

float classp, test, assgn, exam, prctscore,ave;

cout<<"Student Name: ";

cin.getline(name,100);

cout<<"Class Participation: "; cin>>classp;

while(classp <0 || classp > 100){  cout<<"Class Participation: "; cin>>classp; }

cout<<"Test: "; cin>>test;

while(test <0 || test > 100){  cout<<"Test: "; cin>>test; }

cout<<"Assignment: "; cin>>assgn;

while(assgn <0 || assgn > 100){  cout<<"Assignment: "; cin>>assgn; }

cout<<"Examination: "; cin>>exam;

while(exam <0 || exam > 100){  cout<<"Examination: "; cin>>exam; }

cout<<"Practice Score: "; cin>>prctscore;

while(prctscore <0 || prctscore > 100){  cout<<"Practice Score: "; cin>>prctscore; }

ave = (int)(classp + test + assgn + exam + prctscore)/5;

cout <<setprecision(1)<<fixed<<"The average score is "<<ave;  

return 0;}

Explanation:

The required parameters such as cin, cout, etc. implies that the program is to be written in C++ (not C).

So, I answered the program using C++.

Line by line explanation is as follows;

This declares name as character of maximum size of 100 characters

char name[100];

This declares the grading items as float

float classp, test, assgn, exam, prctscore,ave;

This prompts the user for student name

cout<<"Student Name: ";

This gets the student name using getline

cin.getline(name,100);

This prompts the user for class participation. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Class Participation: "; cin>>classp; </em>

<em> while(classp <0 || classp > 100){  cout<<"Class Participation: "; cin>>classp; } </em>

This prompts the user for test. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Test: "; cin>>test; </em>

<em> while(test <0 || test > 100){  cout<<"Test: "; cin>>test; } </em>

This prompts the user for assignment. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Assignment: "; cin>>assgn; </em>

<em> while(assgn <0 || assgn > 100){  cout<<"Assignment: "; cin>>assgn; } </em>

This prompts the user for examination. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Examination: "; cin>>exam; </em>

<em> while(exam <0 || exam > 100){  cout<<"Examination: "; cin>>exam; } </em>

This prompts the user for practice score. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Practice Score: "; cin>>prctscore; </em>

<em> while(prctscore <0 || prctscore > 100){  cout<<"Practice Score: "; cin>>prctscore; } </em>

This calculates the average of the grading items

ave = (int)(classp + test + assgn + exam + prctscore)/5;

This prints the calculated average

cout <<setprecision(1)<<fixed<<"The average score is "<<ave;  

8 0
3 years ago
Which of the following are incident priorities?
xenn [34]

Answer:

what are the options?

reply in comment so i can help:)

5 0
2 years ago
The process where the programmer steps through each of the program's statements one by one is called
viva [34]

The process where the programmer steps through each of the program's statements one by one is called \sf\purple{hand \:tracing}.

\bold{ \green{ \star{ \orange{Mystique35}}}}⋆

5 0
3 years ago
Which IDEs support multiple high-level programming languages? Select all that apply.
nata0808 [166]

Answer:

eclipse, xcode, and visual studio

6 0
2 years ago
Read 2 more answers
Other questions:
  • Ideation includes all of the following EXCEPT
    5·1 answer
  • An unwanted program that can spread itself to other computers is called what?
    15·2 answers
  • After reviewing the various types of network connections available, a client chooses a network connection that is considered to
    13·1 answer
  • Seth is researching new developments in cancer treatments. Which suggestion would be most beneficial to making sure his search r
    14·1 answer
  • Which is a false statement considering copyright law?
    13·2 answers
  • Supporting mobility and smartphone apps is important to MasterCard. What challenges does MasterCard face in rolling out smartpho
    11·1 answer
  • Tell me the most scariest website you know and i'll give you brainlest
    5·1 answer
  • Create a mobile app plan using PowerPoint slides to show mock-ups of screens,
    6·1 answer
  • Instructions
    13·1 answer
  • Which of the following tabs on the Ribbon contains the command to add a Quick Part to a document? A Design B Insert C View D Hom
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!