Question

In one C++ program: a.) Write a code to asks the user for her/his full name...

In one C++ program:

a.) Write a code to asks the user for her/his full name
b.) Write a code that asks the user to enter information related to a car the user likes (year, make, model)
c.) Write a code that asks the user to enter the amount of time or gas or money the user spends to commute weekly
d.) Write a code that asks the user to enter the number Kwh (used monthly) and compute the user electricity bill.
e.) Write a code that asks the user the quantity of water they drink daily (using a threshold, you decide whether it is enough water or not)

Display the information gathered in Questions A to E.

Homework Answers

Answer #1

CODE IN C++:


#include <iostream>
using namespace std;

int main()
{
string name;
cout<<"What is your name ?"<<endl;
getline(cin,name);
string car_name;
cout<<"What is your car model ?"<<endl;
getline(cin,car_name);
int car_year;
cout<<"What year is your model ?"<<endl;
cin>>car_year;
int amount;
cout<<"Enter the amount of time or gas or money you spend to commute weekly"<<endl;
cin>>amount;
int bill;
cout<<"Enter the number Kwh (used monthly) "<<endl;
cin>>bill;
int per_unit;
cout<<"Enter cost per unit"<<endl;
cin>>per_unit;
cout<<"Your bill is : "<<bill*per_unit<<endl;
int water;
cout<<"Enter the quantity of water you drink daily"<<endl;
cin>>water;
if(water>=10) //taking threshold to be 10 litres
{
cout<<"The amount of water you drink is sufficient";
}
else
{
cout<<"You should drink atleans 10 litres of water everyday ";
}
  
}

OUTPUT SNIPPET:

Please give an upvote if you liked my solution.

Thank you:)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Please Write code in visual studio Roman Numeral Converter Write a program that asks the user...
Please Write code in visual studio Roman Numeral Converter Write a program that asks the user to enter a number within the range of 1 through 10. Use a switch statement to display the Roman numeral version of that number. Input Validation: Decide how the program should handle an input that is less then 1 or greater than 10.
A. Write a Java program that asks the user to enter “bus” or “subway” or “walk”....
A. Write a Java program that asks the user to enter “bus” or “subway” or “walk”. If the user enters “bus” display “$1.00”. If they enter “subway” display “$1.50 and if they enter “walk” display “Free”. B. Write a java program that creates the following two arrays: String[] candidates = {“S Jones”,”Justin Fairfax”,”Clark Duncan”}; int[] votes = {7345,4324,3211}; Write the code that will search the votes array for the candidate with the largest number of votes and prints the name...
Write a program that asks the user for the name of a file. The program should...
Write a program that asks the user for the name of a file. The program should display only the first five lines of the file’s contents. If the file contains less than five lines, it should display the file’s entire contents. by python using while loop
in c++ Write a program that asks the user for the speed of a vehicle (in...
in c++ Write a program that asks the user for the speed of a vehicle (in miles per hour) and how many hours it has traveled. It should use a loop to display the total distance traveled. The speed traveled should be limited by the fastest speed achieved by a car thus far. Values should not be negative.•Ex: if hours = 3 and speed = 40, then the program should display•Hour 1: Distance Traveled: 40 miles•Hour 2: Distance Traveled: 80...
Classwork_1.5: Write a C code that ask the user to enter the name of person, gender...
Classwork_1.5: Write a C code that ask the user to enter the name of person, gender (male or female) and age and display these quantities. You need to create a structure to solve this problem. Output:
Write a mips assembly language program that asks the user to enter and integer number and...
Write a mips assembly language program that asks the user to enter and integer number and read it. Then ask him to enter a bit position (between 0 and 31) and display the value of that bit.
Write a program in C++ coding that asks the user to input an integer between 25...
Write a program in C++ coding that asks the user to input an integer between 25 and 50, inclusive. Utilize a WHILE loop to test for INVALID input. If the input is INVALID, the loop will repeat, and ask the user to try again. The pseudocode looks like this: Prompt user to input an integer between 25 and 50 Accept the input from the user Test for invalid input (HINT: use a while loop and the OR operator with 2...
in c++ Write a C++ program that asks the user to enter an integer number and...
in c++ Write a C++ program that asks the user to enter an integer number and prints it back "vertically" to the screen. Use recursion in your solution. As an example of how the program will work: Please enter an integer: 12345 The integer you entered will print vertically as: 1 2 3 4 5
Write a C program that asks the user to enter two integers x and n. Then...
Write a C program that asks the user to enter two integers x and n. Then the program computes xn (=x * x * x …… (n times)) using for loop. using printf scanf
Python code only! (Do not include breaks or continue functions) Write a program that asks the...
Python code only! (Do not include breaks or continue functions) Write a program that asks the user to enter the amount that they budgeted for the month. A loop should then prompt the user to enter their expenses, one at a time and to enter 0 to quit. When the loop finishes, the program should display the the amount of budget left. (a negative number indicates the user is over budget and a positive number indicates the user is under...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT