Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I got this note from my teacher I would like to know where to make the corrections Good, but you must indent your code.

I got this note from my teacher I would like to know where to make the corrections
"
Good, but you must indent your code. Why does the for loop start at -1 because class[-1] would be invalid? That would not work properly. If class[] is an array then it should be declared first.
"
Instructions

Create a pseudocode design to prompt a student for their Student ID and the titles of the three classes they want to add. The solution should display the Students ID and a total bill.

  • Bill a student using the following rules:

    • Students can only add up to 3 classes at a time.

    • Each class costs $150.00

    • A 5% technology fee is added to the total cost.

    • If the student is taking three classes and working for more than 20 hours per week, a message displays prompting the make an appointment with their faculty advisor.

    • If the student adds more than three classes, an error message is printed.

Solution

# taking student Id as input

DISPLAY "Enter a StudentID? "

READ studentId

# reading How many classes student want to opt for

DISPLAY "Enter how many classes you want to add? "

DISPLAY "*****1 class free if you opt for three classes*****"

READ no_of_classes

# checking if user enters more than 3 classes

IF no_of_classes > 3 THEN

OUTPUT "More than 3 classes not allowed, max allowed is 3 classes"

EXIT

ENDIF

# reading class titles of each of the class user enters

FOR i <- 1 TO no_of_classes

OUTPUT "Enter the class title"

READ class[i]

ENDFOR

# reading number of hours user work per week

DISPLAY "Enter number of hours you work per week? "

READ no_of_hours

# if no of classes opted is 3

IF no_of_classes == 3 THEN

# one class free that's why subtracting 150

class_cost = 150 * no_of_classes - 150

# calculating the bill

bill = class_cost + (5/100) * class_cost

# if number of hours greater than 20 per week

IF no_of_hours > 20

THEN

OUTPUT "Please make an appointment with the faculty advisor"

ENDIF

# if number of classes opted is less than 3

ELSE

class_cost = 150 * no_of_classes

bill = class_cost + (5/100) * class_cost

ENDIF

OUTPUT "STUDENTID : ", studentId

OUTPUT "Total bill need to be paid is: ", bill


Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions