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.
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:)
Get Answers For Free
Most questions answered within 1 hours.