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

  Lab11

ltbrgt

  Positive integer value, and computes

Write a function in c++ that reads a positive integer value, and computes

  Write a program for implementing array abstract data type

Write a program for implementing array abstract data type.

  Flipflapsthe project is to design and write a c 11fltk game

flipflapsthe project is to design and write a c 11fltk game program with a graphical user interface.the game is based

  What is the output of the following statements

What is the output of the following statements? Suppose a and b are int variables, c is a double variable, and a = 13, b = 5, and c = 17.5.

  Invites user to enter a random string

Invites user to enter a random string of lower case letters 2)get the string on the same line as the invitation 3)checks correctness of input(if its only lowercase letters 4)computes number of letters that is not being used 5)program out puts the ans..

  Write function compute square root together with prototype

Write a C++ function called compute together with its prototype that is passed 2 integers, A and B and returns the square root of A2+B2 ,as a double.

  Write a program that grades an online quiz

write a program that grades an online quiz. The program asks the student to enter his/her answer to 10 multiple-choice questions. The program stores the student's responses in an array and then compares those responses to the correct answers to de..

  Write a fraction class whose objects will represent fraction

Write a fraction class whose objects will represent fractions. You should provide the following member functions: Two constructors, a default constructor which assigns the value 0 to the fraction, and a constructor that takes two parameters

  Takes 100 number in an array

Write a program in c++ that takes 100 number in an array and add them and print the sum

  Analyze this polynomial

Write an algorithm describing the steps you would use to analyze this polynomial:

  Up through 2 to the 10th power

program should compute and output all of the "powers of two" from 2 to the 0th power, up through 2 to the 10th power.

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