Answer:
Don't forget to close any parentheses you open. Other then that everything looks fine, I just polished it a little bit
Explanation:
name = input("What is your first name? ")
print("Hello", name)
age = int(input("How old are you? "))
print("In 10 years you will be", (age+10))
print("In 20 years you will be", (age+20))
print("5 years ago you were", (age-5))
True, false, false. Hope this helps:)
Answer:
Yes. Pseudocode is an improvement over the IPO chart because it lays out the sequence of steps for a particular program
Explanation:
The input–process–output (IPO) chart is a widely used approach in systems analysis and software engineering for describing the structure of an information processing program or other process. The chart has three components (Input, Process and Output), and you write the description of each component in plain English, not code or mathematical formulas.
Pseudocode is a procedure for solving a problem in terms of the actions to be executed and the order in which those actions are to be executed.
Pseudocode is an improvement over the IPO chart because it shows the step by step sequence to be followed by a particular program unlike the IPO chart which just break the program into Input, Process and Output.
Answer:
#include <iostream>
#include<iomanip>
using namespace std;
double DrivingCost(double drivenMiles, double milesPerGallon, double dollarsPerGallon)
{
double dollarCost = 0;
dollarCost = (dollarsPerGallon * drivenMiles) / milesPerGallon;
return dollarCost;
}
int main()
{
double miles = 0;
double dollars = 0;
cout << "Enter miles per Gallon : ";
cin >> miles;
cout << "Enter dollars per Gallon: ";
cin >> dollars;
cout << fixed << setprecision(2);
cout << endl;
cout << "Gas cost for 10 miles : " << DrivingCost(10, miles, dollars) << endl;
cout << "Gas cost for 50 miles : " <<DrivingCost(50, miles, dollars) << endl;
cout << "Gas cost for 400 miles: "<<DrivingCost(400, miles, dollars) << endl;
return 0;
}
Explanation:
- Create a method definition of DrivingCost that accepts three input double data type parameters drivenMiles, milesPerGallon, and dollarsPerGallon and returns the dollar cost to drive those miles
.
- Calculate total dollar cost and store in the variable, dollarCost
.
- Prompt and read the miles and dollars per gallon as input from the user
.
- Call the DrivingCost function three times for the output to the gas cost for 10 miles, 50 miles, and 400 miles.