Q1a) Instructions Consider the following program segment: //include statement(s) //using namespace statement int main() { //variable declaration //executable statements //return statement } Write a...


Q1a)


Instructions


Consider the following program segment:


//include statement(s)
//using namespace statement

int main()
{
//variable declaration

//executable statements

//return statement
}


Write a C++ statement that includes the header file iostream.


Proceed through all the steps in this activity by clicking the navigation arrows at the bottom of this pane after completing each step.


Write a C++ statement that allows you to use cin, cout, and endl without the prefix std::.


Write C++ statement(s) that declare the following variables: num1, num2,num3, and average of type int.


Write C++ statements that store125 into num1,28 into num2, and–25 into num3.


Write a C++ statement that stores the average of num1, num2, and num3 into average.


Final Step:


Write C++ statement(s) that output the values of num1, num2, num3, and average.


Then compile and run your program by clicking the blue run button on the right side of the screen.



Q1b)


Write a program to implement and test the algorithm that you designed forExercise 15 ofChapter 1. The instructions toExercise 15 have been posted below for your convenience:


Exercise 15



Given the radius, in inches, and price of a pizza, design an algorithm to find the price of the pizza per square inch.


You may assume that the value of π =3.141593.


In your program, declare a named constant PI to store this value.


Below is an example of how the completed program should work:


Enter the radius of the pizza: 20 Enter the price of the pizza: 22 The price per square inch is: 0.017507


Since your program handles currency, make sure to use a data type that can store decimals.



Q1c)


A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one liter of milk is $0.38, and the profit of each carton of milk is $0.27.


Write a program that prompts the user to enter:



  1. The total amount of milk produced in the morning.


The program then outputs:




  1. The number of milk cartons needed to hold milk.



    • Round your answer to the nearest integer.




  2. The cost of producing milk.




  3. The profit for producing milk.



Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here