Warning: Trying to access array offset on value of type bool in /home/topgsnkq/timelyhomework.com/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 570

Programming C/C++ assignments, Computer Science homework help

 

You’ll need to download this To write the program. The programs will be written using the Microsoft Visual C++ Express Edition IDE (Integrated Development Environment), which can be downloaded from the Microsoft Web Site.

 

 

 

For your assignment to be graded, you must identify yourself by including a comment block at the beginning of your program source code. This comment block must include your name, the date, the assignment number, and your student identification number. You also must provide a description and list of key variables and parameters used.

An example of the minimum C++ comment block is:

/**

* Name: Who you are.(ask me)

* Date: When you did the work.ask me

* Assignment: Number 1

* Student Number: AAXXXXXXX ask me

* Description: This program does a, b, and c.(what it does)

*/

 

 

 

_______________________________________________________________

 

Programming in C/C++

 

 

 

Assignment 1

 

 

 

Write a console program to:

 

 

 

1. Prompt the user to enter two numbers followed by an arithmetic operator

 

 

 

( +, -, / or *).

 

 

 

2. Do the specified arithmetic operation and display the result as both an integer and a floating point number, on separate lines.

 

 

 

3. If the result of the calculation is between 1 and 100 display a message that indicates this.

 

 

 

4. Prompt the user to enter their first and last name (with a space in between.) Use the getline( ) function to read in the name.

 

 

 

5. On a new line display the sentence: “This program was written by your name.” (your name should be in all Uppercase.) ask me

 

 

 

Example: This program was written by JOE SMITH ask me

 

 

 

_______________________________________________________________

 

 

 

Assignment 2

 

 

 

Write a console program to:

 

 

 

1. Prompt the user to enter two decimal numbers followed by an arithmetic operator

 

 

 

( +, -, / or *).

 

 

 

2. Call a function to do the specified arithmetic operation and return the result

 

 

 

3. Display the arithmetic expression followed by an equal sign followed by the result as a floating point number, with 2 decimal places and then with 3 decimal places on separate lines.

 

 

 

Example: 3.00 + 2.00 = 5.00

 

 

 

4. Prompt the user to see if they want to do more calculations. Allow the user to do more calculations until they enter either an ‘N’or an ‘n’ for no.

 

 

 

5. Use a for-loop to display 5 random numbers. Display a heading above the random numbers.

 

 

 

6. Prompt the user to enter their first and last name (with a space in between.) Use the getline( ) function to read in the name.

 

 

 

7. On a new line display the sentence: “This program was written by your name.” (your name should be in all Uppercase.) (ask me)

 

 

 

Example: This program was written by JOE SMITH (ask me)

 

 

 

 

 

Note: Make your program user friendly. The prompts should be informative and descriptive. The output should be displayed in an easy to read format (not all packed together). Remember to use whitespace to make it readable

 

____________________________________________________________________

 

 

 

Assignment 3

 

 

 

Write a console program to do Chapter 12 Exercise 3,

 

In this exercise, you complete a program that displays the color of an item.

 

A. Code the program so that it displays the color of the item whose item number is entered by the user. All item numbers contain exactly five characters. All items are available in four colors: blue, green, red, and white. The third characters in the item number indicates the item color, as follows:

 

Character               Color

 

B or b                     Blue

 

G or g                     Green

 

R or r                      Red

 

W or w                    White

 

For example, if the user enters 12b45, the program should display the word “blue” on the screen. If the item number does not contain exactly five characters, or if the third character is not one of the characters listed above, the program should display an appropriate message on the screen.

 

 

 

B. Save then build the solution.

 

 

C. Execute the program. Test the program using the following item numbers: 12x, 12b45, 99G44, abr55, 78w99, and 23abc.

 

 

D. When the program is working correctly, close the Output window, then use the file menu to close the solution.

 

 

 

Note: The program should use a void function to check the item number to determine the color of the item, and the color should be given to the calling function by using a reference variable. Use an array to store the colors and corresponding characters.

 

________________________________________________________________________________

 

 Assignment 4

 

Write a console program to:

 

1. Read an input file that contains sets of 3 numbers separated by the delimiter (#) until the end of file. Check that the file was successfully opened.

 

2. All program output should be written to the output file “ProgrammingAssignment4_Output.txt”

 

3. For each set of 3 numbers, determine if the 3 values can form the sides of a triangle. (The sum of the lengths of any two sides of a triangle must be greater than the length of the third side. For Example, the numbers 3, 4, and 5 can form a triangle because 3+4 > 5, 4+5 > 3, and 5+3 > 4. In contrast, the numbers 1, 2, and 5 cannot form a triangle because 1+2 < 5. Thus, if you are given any three integers, you can determine whether they could possibly form a triangle or not by applying this general principle.)

 

4. If the values cannot form a triangle, display the appropriate message in the output file. For those sets of numbers that can form a triangle, display the type of triangle and the perimeter of the triangle. (Use the triangle class described below to determine the type and perimeter, but create the output in the main method.) Example: The values 3, 4 and 5 form a right triangle with perimeter = 12. The values 1, 1, and 10 cannot form a triangle.

 

5. Create a Triangle class that contains a constructor and 4 methods. The constructor must set the values of the sides of the triangles. There should be a method to do each of the following: a. Calculate and return the perimeter of the triangle b. Determine if the triangle is a right triangle (a2 + b2 = c2, where c is the hypotenuse – the largest side), Return True if it is, and False if it is not. c. Determine if the triangle is an equilateral triangle (all 3 sides are equal). Return True, if it is and False if it is not. d. Determine if the triangle is an isosceles triangle (only 2 sides are equal). Return True, if it is and False if it is not.

 

 

 

 

 

 

 

Attachments: 
 
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "GET10" in your order"

If this is not the paper you were searching for, you can order your 100% plagiarism free, professional written paper now!

Order Now Just Browsing

All of our assignments are originally produced, unique, and free of plagiarism.

Free Revisions Plagiarism Free 24x7 Support