The pseudocode listed below creates a class called Membership. The purpose of th
ID: 3856823 • Letter: T
Question
The pseudocode listed below creates a class called Membership. The purpose of the class is to determine the the cost of membership to a local health clug. The user will create an object based on the class and send in to it the type of membership the user wants either single or family. The class will also calculates if the user wants any additional costs such as tennis, rock climbing or time with a personal trainer Which line of code creates an object based on this class?
class Membership
begin constructor (usertype as string)
private type as string
private extras as string
private extracost as float
private dues as float
DetermineBaseCost
DetermineExtras
end constructor
begin DetermineBaseCost
if type = "Single" then
dues = 50
else
dues = 100
end if
end
begin DetermineExtras
print "Enter T for tennis, R for rock climbing P for personal trainer or N for none. Enter Q to quit"
input extras
while extras != "Q"
if extras = "T" then
dues = dues + 25
else if extras = "R" then
dues = dues + 100
else if extras = "P"
dues = dues + 50
else
dues = dues + 0
end if
print "Enter T for tennis, R for rock climbing or P for personal trainer. Enter Q to quit"
input extras
end loop
end
begin ReturnDues
return dues
end
end class
A.) my_membership = Membership
B.) my_Membership = new Membership(usertype)
C.) Membership
D.) Call Class Membership
Explanation / Answer
Essentially the question is asking how to instantiate the class to create the object.
This can be done by using the line of code given in option (B).
Solution : (B)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.