Calculator C++

Calculator C++ 1

Develop a Mathematics Program that can be used to teach learners how to do basic arithmetic, including: add, subtract, multiply, and divide.Prompt the user to input two whole numbers. Either input them one by one or all at
once.Ask the user to enter the symbol that they would like to use, i.e. either add (+),
subtract (-), multiply (*), or divide (/)Make the calculations based on the input provided, then output the answer.Ensure that it handles division by zero, which cannot be done.Ask the user if they would like to perform another mathematical calculation and restart
the processIt should have an exit function to terminate the program.

Coin Toss Simulator

Coin Toss Simulator 2

Coin Toss Simulator
Write a class named Coin. The Coin class should have the following member variable: • A string name sideUp. The sideUp member variable will hold collet “heads” or “tails” indicating the side of the coin that is facing up. The Coin class should have the following member functions: • A default constructor that randomly determines the side of the coin that is facing up (“heads” or “tails”) and initializes the sideUp member variable accordingly. • A void member function named toss that simulates the tossing of the coin. When the toss member function is called, it randomly determines the side of the coin that is facing up (“heads” or “tails”) and sets the sideUp member variable accordingly. • A member function named getSideUp that returns the value of the sideUp member variable.
Write a program that demonstrates the Coin class. The program should create an instance of the class and display the side that is initially facing up. Then, use a loop to toss the coin 20 times. Each time the coin is tossed, display the side that is facing up. The program should keep count of the number of times heads is facing up and the number of times tails is facing up, and display those values after the loop finishes.

vehicleType C++

vehicleType C++ 3

Create a C++ program that accomplishes the following:Create a class called vehicleType that has the following members:
Public members:-A function called getCost that returns the cost of the vehicle-A function called setCost to set the cost of the vehiclePrivate members-A private member called costCreate a class called carType that uses vehicleType as its base class. This class will have the following members:
Public members:A function called setStyle to set the style
A function called setColor to set the color
A function called GetStyle that returns the style
A function called GetColor that returns the color
Default constructor
Parameters constructor (you should be able to pass all the information into the constructor y create a car with such information)
Private members:A variable called style
A variable called color
A variable called License_Plate
***Create all the functions and constructors’ definitions. ***Test your classes:
Create instances of your carType class.
Retrieve all the information about a car (color, style, cost, License Plate).

ALL CAPS C++

ALL CAPS C++ 4

Your uncle has asked for a program that will help him translate
messages into ALL CAPS, so that it will look like it is shouting. (He is a
little hard of hearing–and also a bit daft.)
Write a program which does the following:
● Prompts, “Enter the message, one line at a time:”, followed by a
newline.
● Allows the user to enter a line of text, which may include letters,
numbers, and symbols.
● After the user hits return, the computer outputs the line translated
into all caps, followed by a newline. (Numbers and symbols should
not be altered.)
● The computer will continue accepting lines of the message,
translating each into all caps and printing it out, until we reach EOF
(i.e., the user will hit Ctrl-D on a new line).

EmployeesHighestSalary

EmployeesHighestSalary 5

Write a complete C++ program using Arrays, Functions and Files. An array named salary of size 1500 must be declared in the main. The function empSalary does the following:
* *
The function will display the following output on separate lines: The highest salary in the array1. receives the array and size. The function also asks user to enter the file name where the salary data is stored (salaries.txt) and reads the data from the file and stores it in the array. The file has the salary information of 1000 to 1500 employees. The exact number is ***** known and you may have to use a counter to track the exact number of employees The function will display the following output on separate lines: The highest salary in the array

Area of Semi Circle

Area of Semi Circle 6

Write a C++ code to estimate the area of the semi-circle using N rectangles (check lecture slides). Your code should ask the user to enter the number of rectangles, prints out the estimated area and the relative error.

Encrypt

Encrypt 7

A company wants to transmit data over the telephone, but they are concerned that their phones may be tapped. All of their data is transmitted as four-digit integers. They have asked you to write a program that will encrypt their data so that it may be transmitted more securely.
Your program should read a four-digit integer and encrypt it as follows: Replace each digit by the remainder after the sum of that digit plus 7 is divided by 10. Then swap the first digit with the third, and swap the second digit with the fourth. Then print the encrypted integer. Write a separate program that will encrypt a four-digit integer and decrypt it to form the original number. You can use ‘0000’ to terminate the program.

Rational

Rational 8

Modify the rational number class. Represent rational numbers as two values of type int,
one for the numerator and one for the denominator.
Include a constructor with two arguments that can be used to set the member variables of
an object to any legitimate values. Also include a constructor that has only a single parameter
of type int; call this single parameter whole_number and define the constructor so that
the object will be initialized to the rational number whole_number/1. Also include a
default constructor that initializes an object to 0 (that is, to 0/1).
Overload the input and output operators >> and <<. Numbers are to be input and output in the form 1/2, 15/32, 300/401, and so forth. Note that the numerator, the denominator, or both may contain a minus sign, so -1/2, 15/32, and -300/-401 are also possible inputs. Overload all of the following operators so that they correctly apply to the type Rational: ==, <, <=, >, >=, +, -, *, and /. Also overload the unary -.
Use the same formulas as assignment 8 for defining the overloaded operators. Makes use of
the examples of lecture 20 for the << and >> overloading operators overloading. The Boolean
overloaded operators should return a bool value.
Provide a main function that thoroughly tests your class implementation. Create two
objects (each representing a rational number). Test the two objects with each of the
overloaded functions. Also test the operators with a combination of integers and objects.

DiaryEntry

DiaryEntry 9

You are to implement a class to define the type “DiaryEntry”. The interface of the class along with the description of its members is given in the file “DiaryEntry.h” attached to this question. Based on the description of the class, implement the methods of the class, and test your class using the attached cpp file: “DiaryTest.cpp”.

AreaRectangle

AreaRectangle 10

Write a program that calculates the area and perimeter of a rectangle. The side lengths should be inputted by the
user. The area and perimeter of the rectangle should be calculated and returned using 2 user defined functions; area &
perimeter and then outputted as shown below. Note that 5.6 and9.8 are only examples.
A 5.6 by 9.8 rectangle has an area of 54.88 and a perimeter of 30.8.

×
New Download