CSE111 Lab Assignment 4
CSE111 Lab Assignment 4
Subtasks:
Sample Input:
1
+
2
Sample Output:
Let’s Calculate!
Value 1: 1
Operator: +
Value 2: 2
Result: 3
Question 2
Write a class called Customer with the required constructor and methods to get the
following output.
Subtasks:
1. Create a class called Customer.
2. Create the required constructor.
3. Create a method called greet that works if no arguments are passed or if one
argument is passed. (Hint: You may need to use the keyword NONE)
4. Create a method called purchase that can take as many arguments as the user
wants to give.
The Giant Panda Protection and Research Center in the Sichuan province of southwest
China, actually employs a category of workers known as panda nannies. The primary
responsibility is to play with adorable panda cubs and name them, determine gender,
keep track of their age and hours they sleep. So being a programmer panda nanny, you
will create a code that will do all these works for you.
Analyze the given code below to write Cat class to get the output as shown.
Hints:
• Remember, the constructor is a special method. Here, you have to deal with
constructor overloading which is similar to method overloading.
• You may need to use the keyword None
• Your class should have 2 variables
[You are not allowed to change the code below]
Question 5
Implement the design of the Student class so that the following output is produced:
It must have methods to move up, down, left, right and a print_position() method for
printing the current coordinate.
Note: All moves are 1 step. That means a single call to any move method changes the
value of either x or y or both by 1.
Design the Programmer class such a way so that the following code provides the
expected output.
Hint:
o Write the constructor with appropriate printing and multiple arguments.
o Write the addExp() method with appropriate printing and argument.
o Write the prinDetails() method
Design the Student class such a way so that the following code provides the expected
output.
Hint:
• Write the constructor with appropriate default value for arguments.
• Write the dailyEffort() method with appropriate argument.
• Write the prinDetails() method. For printing suggestions check the following
instructions.
➢ If hour <= 2 print 'Suggestion: Should give more effort!'
➢ If hour <= 4 print 'Suggestion: Keep up the good work!'
➢ Else print 'Suggestion: Excellent! Now motivate others.'
Implement the design of the Patient class so that the following output is produced:
Implement the design of the Avengers class so that the following output is produced:
Design the Shinobi class such a way so that the following code provides the expected
output.
Hint:
• Write the constructor with appropriate default value for arguments. Set the initial
salary and mission to 0.
• Write the changeRank() method with appropriate argument.
• Write the calSalary() method with appropriate argument. Check the following
suggestions
➢ Update the number of mission from the given argument.
➢ If rank == 'Genin' then salary = #mission * 50
➢ If rank == 'Chunin' then salary = #mission * 100
➢ else salary = #mission * 500
• Write the printInfo() method with appropriate printing.
Design the ParcelKoro class such a way so that the following code provides the expected
output.
Note: For the method calculate fee: if the delivery location is not given, the
location_charge will be 50 taka or else 100 taka. Also, while calculating total fee, if the
product weight is 0 the total_fee should also be 0.
Implement the design of the Batsman class so that the following output is produced:
Question 14
Implement the design of the EPL_Team class so that the following output is produced:
Question 17
Design a Student class so that the following output is produced upon executing the
following code
Design a Student class so that the following output is produced upon executing the
following code:
[Hint: Each course has 3.0 credit hours. You must take at least 9.0 and at most 12.0
credit hours]
Write the Hotel class with the required methods to give the following output as shown.
Write the Author class with the required methods to give the following outputs as
shown.
Design the Vaccine and Person class so that the following expected output is
generated.
[N.B: Students will get vaccines on a priority basis. So, age for students doesn’t matter]