needs to be written in c++ code
For this assessment, you will develop an application. The application should allow the user to perform a simple calculation. (You should determine the calculation that the user should be able to perform with the application; the user simply inputs or navigates through information to be able to calculate it.)
The user entries will be saved in the appropriate data type, and variables will be used to perform the calculation and return the result back to the user. These projects are to be completed in your Integrated Development Environment (IDE) (such as Visual Studio), and completed as executable C++ applications so you can compile and run them to see if you have any errors. Attach your "zipped" project folders with your submission.
Cpp Code:
#include <iostream>
using namespace std;
int main()
{
//Displaying the operations
cout << "1. Addition\n";
cout << "2. Subtraction\n";
cout << "3. Multiplication\n";
cout << "4. Division\n";
cout << "Enter the calculation to perform" <<
endl;
char choice;
//prompting the user
cin >> choice;
//getting the two numbers
cout << "Enter two numbers\n";
double num1, num2;
cin >> num1;
while(1){
cin >> num2;
if (choice == '4' && num2==0){ //checking if divisor is not
0
cout << "Divisor should not be 0...Try again...Enter number
2\n";
}else{
break;
}
}
//Performing the operation
switch(choice){
case '1':
cout << "Answer is: " << num1 + num2;
break;
case '2':
cout << "Answer is: " << num1 - num2;
break;
case '3':
cout << "Answer is: " << num1 * num2;
break;
case '4':
cout << "Answer is: " << num1 / num2;
break;
default: //If user enters invalid operation
cout << "Invalid Operation\n";
}
return 0;
}
Sample Output:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter the calculation to perform
3
Enter two numbers
4 6
Answer is: 24
needs to be written in c++ code For this assessment, you will develop an application. The...
To write a C++ program to find average of three integers using
functions
Objectives: To get familiar with functions in C++ Task 1: Study the working of user-defined functions in C++ Task 2: To write a C++ program to find average of three integers using functions Programming Instructions: Make new project (Visual C++ Empty Project) named lab6 and add a C++ file named lab6.cpp to this project. (Some IDE may automatically generate main.cpp or source.cpp, then you just rename it...
Using PuTTY Linux Server Task Compiling: 1) Download the two files from blackboard, driver.cpp, and circle.h 2) Create a new directory to store the files in 3) Compile the code a) Run the command g++ driver.cpp -o executable_name, this will compile the code both for driver.cpp and the referenced file circle.h note: -o parameter specifies a new name for the executable, if you do not specify the “-o” parameter the default name of the executable is “a.out”...
Murphy Pizza Palace needs an application to calculate the number of slices of a pizzaof any size can be divided into. The application should do the following: Allow the user to enter the diameter of the pizza, in inches. Calculate the number of slices that can be cut from a pizza that size. Display a message that indicates the number of slices. To calculate the number of slices that can be cut from the pizza, you must know the following...
How do you do this using visual studio on a Mac? You are tasked with creating an application with five PictureBox controls. In the Poker Large folder, you will find JPEG image files for a complete deck of poker cards. Feel free to choose any card image that you like or be creative with this application. Each PictureBox should display a different card from the set of images. When the user clicks any of the PictureBox controls, the name of...
Develop a WPF application that has a button to calculate an employee’s weekly pay, given the number of hours worked. An employee should have a first name, last name, age, and hourly consulting rate. You should be able to create an employee object and provide the hours worked to calculate the weekly pay. The application assumes a standard workweek of 40 hours. Any hours worked over 40 hours in a week are considered overtime and earn time and a half....
In this assessment, you will design and code a Java console application that validates the data entry of a course code (like IT4782) and report back if the course code is valid or not valid. The application uses the Java char and String data types to implement the validation. You can use either the Toolwire environment or your local Java development environment to complete this assignment. The requirements of this application are as follows: The application is to read a...
(Assignment 1 : Question 1) C Mini Project is a mini application that could be developed using C language that involves the concepts of arrays, functions, read and write data techniques. Based on your creativity, you are required to plan, design and develop a mini application for an organisation. You may choose to from the list below or propose your own mini application: 1. Appointment Management System (I prefer to choose this) Your responsibility is to ensure that this project...
OUTPUT MUST MATCH THE IMAGE TO THE TEE. I have
the majority of the program written, just having issues with the
output. Please make sure to have the right alignment, variable data
types and number padding/decimals as shown below!
MUST BE IN C NOT C++/C#! Assume the Item Num is an int that must
be padded with zeros (ex: 1234 ---> 00001234)
Write a C program for a shopping list to run on ocelot. Use the listed items and...
Using C programming Description: You have been tasked to design an application for an engineering firm to measure the performance of their vehicle designs. The user, an engineer will enter data into your program when prompted and will perform the required calculation and output the answer. The formula used for this project calculates the distance an object will cover in meters given an initial velocity, a rate of acceleration and a time of acceleration or travel. 1. Your program must...
You are to create a new application that will execute on your Arduino platform based upon the Blink example that is available in the Arduino Examples folder that you downloaded as part of the IDE. Your application will use a toggle switch to interface with the user. The application will operate by controlling the LEDs based upon the position of the toggle switch. If the user moves the LEDs until new user input is provided. When the user moves the...