Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Refactoring is the process of taking existing code and improving its design without changing the functionality. In this programming assignment, you are going to take

Refactoring is the process of taking existing code and improving its design without changing the functionality. In this programming assignment, you are going to take your code from Programming Assignment 1 and refactor it so that it uses functions. The program should still do the following: Get the name of a student Get the name of three assignments Get the grade of three assignments as integers Calculates the average of the three assignments as a double Displays the name of the student with his/her average to one decimal place Displays the names and grades of the assignments neatly as a table. However, you will now need to create 5 functions. You should write a function for each of the following: Get the name of the student Get the name of the three assignments Get the grade of each of the three assignments Get the average of the three assignments Display the grade information to the student including the students name, average, and list of grades As you can see, you basically need a function for each task your program performs. You will have a total of 6 functions including main. The main function should do nothing but create needed variables to pass to the functions and then call the functions in the correct order to produce the desired output. Make sure you use good programming style. Comment every variable, calculation, and function. Use self-documenting names for variables and functions. You should be able to reuse most of your code that you wrote for Programming Assignment 1. You should use arrays for the assignment names and the assignment grades. The code will need to be moved into the appropriate function. Some minor changes may need to be made to account for passing data into the function and returning a value from the function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions