1. Draw the Flowchart and Write the Program to Calculate the Area of 15 Rooms. the Length

1. Draw the Flowchart and Write the Program to Calculate the Area of 15 Rooms. the Length

<p> 1. Draw the Flowchart and write the program to calculate the area of 15 rooms. The length is 55.2meters, and breadth is 26.34meters.</p><p>Flowchart</p><p>Program #include<iostream> using namespace std; int main() { double length,breadth,area; length=55.2; breadth=26.34; area=15.0*55.2*26.34; cout<<”Area of 15 Rectangle Room is”<<area<<endl; return(0); }</p><p>2. You have been given a job as a programmer on a Software company. In order to accomplish some calculations, you need to know how many bytes the following data types use: char, int, float and double. You do not have manuals, so you can’t look this information up. Write a C++ program that will determine the amount of memory used by these types and display the information on the screen. </p><p>#include<iostream> using namespace std; int main() { cout<<”The size of int data type is”<<sizeof(int)<<endl; cout<<”The size of char data type is”<<sizeof(char)<<endl; cout<<”The size of float data type is”<<sizeof(float)<<endl; cout<<”The size of double data type is”<<sizeof(double)<<endl; return(0); } 3. A car holds 60 litters of petrol and can travel 350 miles before refuel. Write an Algorithm and program that calculates the number of Miles Per Litter the car gets. Display the result on the screen. Hint: MPL=Miles Driven/Litters of Petrol Used</p><p>Algorithm Step 1: Start Step 2: Set petrol=60,distance=350 Step 3: Calcultae MPL=distance/petrol Step 4: Print MPL Step 5: Stop</p><p>Program #include<iostream> using namespace std; int main() { float distance=350.0,petrol=60.0,MPL; MPL=distance/petrol; cout<<”The Miles Per Litter of Car is”<<MPL; return(0); } </p><p>4.Write the algorithm and C++ program to convert from inches to meters Hint: 1 inch = 0.0254 meters</p><p>Algorithm Start Step 1: Read inches Step 2: meters=0.0254*inches Step 3: Display the meters Stop</p><p>Program #include<iostream> using namespace std; int main() { double inches,meters; cout<<”Enter the values in inches”<<endl; cin>>inches; meters=0.0254*inches; cout<<”Value in meters is”<<meters<<endl; return(0); } 5. A car with a 20 litters of petrol tank averages 21.5 Miles Per Litter (MPL) when driven in town and 26.8 Miles Per Litter (MPL) when driven on the high way. Write an Algorithm and a C++ Program that calculates and display the distance the car can travel on one tank of petrol when driven in town and when driven on the high way. Hint: distance=Number of Litters*Average Miles Per Litter</p><p>Algorithm Step 1: Start Step 2: Set MPLtown=21.5, MPLhway=26.8, petrol=20 Step 3: Calculate distancet=petrol*MPLtown Step 4: Calculate distanceh=petrol*MPLhway Step 5: Print the distancet Step 6: Print the distanceh Step 7: Stop</p><p>Program #include<iostream> using namespace std; int main() { float MPLtown=21.5f,MPLhway=26.8f,petrol=20.0f,distancet,distanceh; distancet=petrol*MPLtown; distanceh=petrol*MPLhway; cout<<"The Distance in Town is"<<distancet<<endl; cout<<"The Distance in Highway is"<<distanceh<<endl; return(0); }</p><p>6..Modify the following program so it prints two blank lines between each lines of text. #include<iostream> using namespace std; int main() { cout<<"Two mandolins like creatures in the"; cout<<"dark"; cout<<"Creating the agony of ecstasy."; cout<<" - George Barker"; return(0); }</p><p>Answer #include<iostream> using namespace std; int main() { cout<<"Two mandolins like creatures in the\n\n\n"; cout<<"dark\n\n\n"; cout<<"Creating the agony of ecstasy.\n\n\n"; cout<<" - George Barker"; return(0); } \</p><p>8. Draw the flowchart and write the C++ program to calculate the pay of employee (for one day) based on the hour basis. Hint: pay= Amount Per Hour*Number of Hours Worked</p><p>Flowchart</p><p>Program #include<iostream> using namespace std; int main() { float hours,amount,pay; cout<<”Enter the value for hours”<<endl; cin>>hours; cout<<”Enter the value for amount”<<endl; cin>>amount; pay=amount*hours; cout<<”The pay of employee is”<<pay; return(0); }</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us