Practical assignment Part 1, Part 2 , Part 3 Solved

35.00 $ 17.50 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment

Description

5/5 - (7 votes)

Question 1.
• Complete IPO chart for the Question 6, Week 1 Tutorial questions:
Carlos receives 24 paychecks each year. Each paycheck, he contributes a specific percentage of his gross pay to his retirement plan at work. His employer also contributes to his retirement plan, but at a different rate. Carlos wants a program that will calculate and display the total annual contribution made to his retirement plan by him and his employer. Complete an IPO chart for this problem. Desk-check the algorithm using $1465 as the gross pay, 4% as Carlos’s contribution rate, and 2% as his employer’s contribution rate. Then desk-check it using your own set of data.
• Write, compile and run a program that defines the employer’s contribution rate 2% as constant, read the Carlos’s contribution rate and the gross pay from the keyboard, then calculates and displays the total annual contribution.
Question 2.
Write a C++ program that defines the constant PI = 3.14159, declares double-precision variables x. y, and result, reads values of x and y from the keyboard, then calculates and displays the result of the following mathematical expression:
(𝑥2− 18) (𝑥 + 𝜋)(𝑥−𝑦)𝜋2+ 𝑥𝑦2
Use the following data to check your result:
x = 1.55
y = -3.06
result = 0.0950577
x = -56.88
y = 8.91
result = -0.586493
x = 1
y = 2
result = -0.261283

Practical assignment Part 2 (Version1)

Design an algorithm for a problem that evaluates a weekly temperature. The program will read temperature values (decimal) for each day in a week from the keyboard, and find and display the lowest, highest, and average temperatures in this week with appropriate messages.
Program specifications:
The program is to evaluate a temperature entry; a temperature should be a decimal number between -50 and +50 in Celsius scale.
1. The program will use a for() loop to traverse all days in a week;
2. Use a switch() statement to assign a day name to a string variable dayName (“Monday” for day 1, “Tuesday” for day 2, etc)
3. Read a temperature from the keyboard and add to the total ;
4. Evaluate a temperature entry; a temperature should be a decimal number between -50 and +50 in Celsius scale;
5. Find and displays the lowest and highest temperatures and correspondent day names.
6. Calculate and display the average temperature with 2 digits after the decimal point.
The program output may look like this
School of Vocational Engineering,
Health and Science
RMIT University Page 2 EEET2280 Practical assignment Part 2 _V1
Author: O. Gredeskoul
With the evaluation of the input temperature:
What to do:
• Draw a flowchart for the program design
• Write the program code.
• Compile and run the program.
• Test the program using various values for input to make sure that calculations are correct.
• Ensure that the program code has your “signature” on the top and comments explaining purpose of functions and program’s logic.
Assignment submission:
1. You will demonstrate the working program to the teacher and answer questions
2. Then you will submit the assignment online to the Practical Assessment Part 2 page on the Blackboard.
Your submission must include the following files – all in .pdf format:
• Flowchart of the algorithm design
• The program code with your “signature” and comments
Marking Guide:
No.
Task
Max. Mark
Mark
1
Program works according to the specifications – demonstrated during class time
10
2
Correct code, formatted and commented
5
3
Flowchart of the algorithm
5
Total
20
School of Vocational Engineering,
Health and Science
RMIT University Page 3 EEET2280 Practical assignment Part 2 _V1
Author: O. Gredeskoul

Practical assignment Part 3 (Version 1)

Trucks company

Problem description:

A truck company has a number of trucks to carry heavy loads. Each truck has a number and allowed maximum weight of the load. The allowed weights are stored in a text file in one line separated by space.

 

Develop an algorithm of a program that prints a table with truck’s number, allowed weight, and actual weight, where the actual weight is assigned as a random number in the range of 1000 to 5000 kg

 

 

Program specifications:

 

  1. Start a project “Trucks” in Dev C++
  2. Save main(), and compile template to create an output folder.
  3. Make a text file with any number of integer values in the range 1000 to 5000 written in one line separated by space. Save it as “limits.txt” in the Output/MingW/ folder of your project
  4. Open input file “limits.txt” , use as while() loop to read the numbers, and count how many numbers are in the file; Store this in the variable totalTrucks
  5. Use the following statements to return to the start of the file:

inFile.clear();

inFile.seekg(0, ios::beg);

  1. Declare two arrays actualWeights[totalTrucks] and allowedWeights[totalTrucks];
  2. Fill array actualWeights[] with random numbers in the range 1000 – 5000
  3. Fill array of allowedWeights[] with numbers from file
  4. Open outFile for writing
  5. Use a for() loop to print a table containing a truck number (starting from 1 and to the totalTrucks), allowed weight, and actual weight. You will print the table on the screen and into the outFile.

 

 

 

 

 

 

The output on the screen and in the file may look like that

 

 

 

What to do:

  • Write the program code.
  • Compile and run the program.
  • Test the program using various values for input to make sure that calculations are correct.
  • Ensure that the program code has your “signature” on the top and comments explaining purpose of functions and program’s logic.
  • Demonstrate the working program to the teacher
  • Demonstrate input and output files stored in the Output folder.