Create the equivalent of a four-function calculator

Assignment Help C/C++ Programming
Reference no: EM131212385

Object Oriented Programming

Assignment

Q1: Assuming there are 7.481 gallons in a cubic foot, write a program that asks the user to enter a number of gallons, and then displays the equivalent in cubic feet.

Q2: You can convert temperature from degrees Celsius to degrees Fahrenheit by multiplying by 9/5 and adding 32. Write a program that allows the user to enter a floating-point number representing degrees Celsius, and then displays the corresponding degrees Fahrenheit.

Q3: Create the equivalent of a four-function calculator. The program should ask the user to enter a number, an operator, and another number. (Use floating point.) It should then carry out the specified arithmetical operation: adding, subtracting, multiplying, or dividing the two numbers. Use a switch statement to select the operation. Finally, display the result. When it finishes the calculation, the program should ask whether the user wants to do another calculation. The response can be ‘y' or ‘n'. Some sample interaction with the program might look like this:

Enter first number, operator, second number: 10 / 3 Answer = 3.333333
Do another (y/n)? y
Enter first number, operator, second number: 12 + 100 Answer = 112
Do another (y/n)? n

Q4: Write a program that declares a variable that can hold the letter grade a student will receive in this class. Prompt the user to enter the letter. Then read it in, and echo it with explanation.

Q5:  What is the output after executing the following segment of code? int num = 10;
if (num > 10)
cout << "Yes" << endl; else
cout << "No" << endl;

a) Yes
b) Yes and No

c) No
d) Nothing

Q6: What is the output after executing the following segment of code?

int num = 5; if(num < 4)

cout << "Red" << endl; else
if(num < 10)
cout << "Yellow" << endl; else
cout << "Green" << endl;

a) Red
b) Green

c) Yellow
d) Two of the above

Q7: What is the output of the following code segment?

int x = 3; int y = 6;
if(x < 0 && y = 2) x = 40;
cout << x << " " << y << endl;

a) 3 6    c) 40 6

b) 3 2     d) 40 2

Q8: Write a program for a furniture company. Ask the user to choose P for pine, O for oak, or M for mahogany. Show the price of a table manufactured with the chosen wood. Pine tables cost $100, oak tables cost $225, and mahogany tables cost $310.

Q9: Write a program that asks the user to type a vowel from the keyboard. If the character entered is a vowel, display "OK"; if it is not a vowel, display an error message. Be sure to allow both uppercase and lowercase vowels. For this exercise, assume y is not a vowel.

Q10: Identify the error in the following program. vinclude <iostrearn.h>

void main()

{

int i = 0;
i = i 1;
cout c< i « II
/comment\*  i + 1; cout cc i;
}

b.) #include <iostream.h>
void main()

{
short 1-2500, j-3000;
cout » "i + j • m ›, -(i+j);

}

Reference no: EM131212385

Questions Cloud

Incorporated into us trade legislation : To what extent have the traditional arguments that justify protectionist barriers actually been incorporated into US trade legislation? At what stage in US trade history did protectionism reach its high point?
What has been happening to the reported releases over time : What has been happening to the reported releases over time? These data are self-reported by the companies. Do you trust its accuracy? If you were concerned about the health risk posed by the toxic releases in your neighborhood, what would you do a..
Factors that you use to make determination : Consider how you evaluate whether a firm is "one of the good guys" or not. What are some of the factors that you use to make this determination?
Defined contribution pension plan : Fukushima Company provides its employees with vacation benefits and a defined contribution pension plan. Employees earned vacation pay of $19,500 for the period. The pension plan requires a contribution to the plan administrator equal to 6% of employ..
Create the equivalent of a four-function calculator : Create the equivalent of a four-function calculator. The program should ask the user to enter a number, an operator, and another number.
Give some examples of technology-based regulation : Give an example in which ecological sustainability-based legislation also happens to lead to an efficient outcome.
Benefit an organization and business : Explain how unethical behavior can benefit an organization and business.
Explain process of adjustment to new long run equilibrium : Show graphically the effect on the number of dishwasher models offered, after the global market has adjusted to a new long-run equilibrium.-  Explain the process of adjustment to this new long-run equilibrium.
Determine whether the company should purchase the machine : Sandcastle’s Inc.’s management has recently been looking at a proposal to purchase a new brick molding machine. With the new machine, the company would not have to buy bricks. The estimated useful life of the machine is 15 years, and the purchase pri..

Reviews

len1212385

9/19/2016 6:27:10 AM

Write a program for a furniture company. Ask the user to choose P for pine, O for oak, or M for mahogany. Show the price of a table manufactured with the chosen wood. Pine tables cost $100, oak tables cost $225, and mahogany tables cost $310

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd