I was wondering if anyone would be able to help me with the following pseudocode so that it looks good to turn in. Any changes would be helpful.
Completing Homework
Main Module
Declare FindReading As Real
Declare ReadReading AS Real
Declare CompleteAssignment As Real
Declare Pages as Integer
Declare outputPrompt As Real
Get user input
Find assigned reading
Read reading
Complete assignment
End Main Module
Input Data Module
Write "What is the reading for the week?"
Input reading
Write "How many pages is the reading?"
Input pages
Write "How long did it take to complete the reading?"
Input hours, minutes
Write "How long did it take to complete the assignment?"
Input hours, minutes
End Input Data Module
Find Total Hours Module
Declare hours as real
Declare minutes as real
Hours = 1*hours
Minutes = 60/minutes
TotalHours = hours + minutes
That is as far as I have gotten and I need to know if what I have is correct or are there things that I should had added or taken away.
Thanks for the help.
I believe you would have to convert the hours to minutes than add the two:
Input Reading Time Hours
Input Readig Time Minutes
Input Assignment Time Hours
Input Assignment Time Minutes
ReadingTime = (hours * 60) + minutes
AssignmentTime = (hours * 60) + minutes
Total Time = (ReadingTime + AssignmentTime)
To improve the pseudocode, you can make the following changes:
1. Add appropriate comments to describe the purpose of each module.
2. Use correct data types for variables.
3. Maintain consistency in variable names.
4. Separate input and processing steps into different modules for better readability.
Here's an updated version of the pseudocode:
Main Module
Declare FindReading as Real
Declare ReadReading as Real
Declare CompleteAssignment as Real
Declare Pages as Integer
Declare outputPrompt as Real
Call InputData module
End Main Module
InputData Module
Declare Reading as String
Declare Pages as Integer
Declare ReadingTime as Real
Declare AssignmentTime as Real
Write "What is the reading for the week?"
Input Reading
Write "How many pages is the reading?"
Input Pages
Write "How long did it take to complete the reading?"
Input ReadingTime
Write "How long did it take to complete the assignment?"
Input AssignmentTime
Call FindTotalHours module
End InputData Module
FindTotalHours Module
Declare TotalHours as Real
TotalHours = ReadingTime + AssignmentTime
End FindTotalHours Module
With these changes, your pseudocode will be more organized and easier to understand. Remember that pseudocode is not a specific language, but a way to represent your algorithm using simple statements.