Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment Problem(s) O1: Write a program that reads in the values x and y. Your

ID: 3604529 • Letter: A

Question

Assignment Problem(s) O1: Write a program that reads in the values x and y. Your program should compute the expression shown below and assign the result to the variable z. The program should finally print the mean of x, y, and z Note: z=x+4y Sample output Please enter x: 10 Please enter y: 20 The value of z is: 90 The mean of x, y . and z is: 40 The solution: 02: Write a program that asks the user to type the price without tax of one kilogram of tomatoes, the number of kilograms you want to buy and the tax in percent units. The program must calculate the total price including taxes. Sample output Please enter the price vithout tax of one kilogran of tomatoes Please enter the nunber of kilograms:5 Please enter tax in percent units: 3 Total price: 51.5 S.R The solution:

Explanation / Answer

Q1.ans-

#include<iostream>

#iinclude<stdlib.h>

using namespace std;

int main()

{

int x,y,z=0;

cout<<"please enter x:";

cin>>x;

cout<<" ";

cout<<"please enter y:"<<endl;

cin>>y; cout<<" ";

z=x+y;

cout<<"the value of z is:"<<z<<endl;

int mean=(x+y+z)/3;

cout<<"the mean of x,y and z is:"<<mean<<endl;

return 0;

}

Q2.ans-

#include<iostream>

#iinclude<stdlib.h>

using namespace std;

int main()

{

int price,quantity,tax;

cout<<"please enter the price without tax of 1kg of tomato:";

cin>>price;

cout<<" ";

cout<<"please enter number of kilogram:"<<endl;

cin>>quantity; cout<<" ";

cout<<"please enter the tax in percent unit:";

cin>>tax; cout<<" ";

int z=(price * quantity); //total cost of tomatao without tax

int totalcost=((100+tax)*z)/100; //total cost including tax

cout<<"Total Price:"<<totalcost<<"S.R"<<endl;

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote