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
Draw flowchart AND write pseudo code User asks you to develop a program to calculate and...
Draw flowchart AND write pseudo code User asks you to develop a program to calculate and print weekly payroll. Calculations must take into account the following: User input ? a. Income tax rate is rate is 15% (.15*salary) b. Social Security tax is 7.65% (.0765*salary) c. Display salary, income tax, social security tax, and net pay net pay=salary-income tax – social security tax
write a C++ program that asks the user to enter 4 integer numbers then use if...
write a C++ program that asks the user to enter 4 integer numbers then use if ….. elseif ….. elseif ….. else to find the smallest number then display it.
Write a program that asks a user to enter his/her phone number. Then remove all the...
Write a program that asks a user to enter his/her phone number. Then remove all the non-digits from the phone number and then display the digits entered. Hint: you may need to use the syntax “.isdigit()” in your program Sample run Example 1 Please enter your phone number?123-456/7891 1234567891 Example 2 Please enter your phone number?123(456)-7891 1234567891 Example 3 Please enter your phone number?987@654!4321 9876544321
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:
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...
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 Java program that prompts the user to enter his/her name (first and last). Names...
Write a Java program that prompts the user to enter his/her name (first and last). Names are often expressed alphabetically as last name comma space first name. Display the user's alphabetical name and its length. Then output the user's initials. Finally, display the ASCII values of the initials with a space between them. Sample Output (input shown in italics) Enter your full name Jane Doe Your alphabetical name Doe, Jane is 9 characters long Your initials are JD ASCII of...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT