0% found this document useful (0 votes)
105 views2 pages

CSE110 Mid1 4

This document contains instructions for a midterm exam for an Object Oriented Programming course. It includes 5 questions to test various concepts related to OOP and Java programming. Students are to write code to calculate ISBN checksums, define an Account class with methods like deposit and withdraw, tokenize a given string, and analyze exam score data for multiple students and exams. The questions assess different cognitive levels and course outcomes, and are worth between 4-10 marks each toward the final grade.

Uploaded by

Sanjida Islam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views2 pages

CSE110 Mid1 4

This document contains instructions for a midterm exam for an Object Oriented Programming course. It includes 5 questions to test various concepts related to OOP and Java programming. Students are to write code to calculate ISBN checksums, define an Account class with methods like deposit and withdraw, tokenize a given string, and analyze exam score data for multiple students and exams. The questions assess different cognitive levels and course outcomes, and are worth between 4-10 marks each toward the final grade.

Uploaded by

Sanjida Islam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

EAST WEST UNIVERSITY

Department of Computer Science and Engineering


B.Sc. in Computer Science and Engineering Program
Mid Term I Examination, Spring 2022 Semester
Course: CSE 110-Object Oriented Programming, Section-4
Instructor: Tanni Mittra, Senior Lecturer, CSE Department
Full Marks: 30 (15 will be counted for final grading)
Time: 1 Hour and 30 Minutes

Note: There are 5 (five) questions, answer ALL of them. Course Outcome (CO), Cognitive Level, and Mark
of each questionnaire are mentioned at the right margin.

1. An ISBN-10 (International Standard Book Number) consists of 10 digits: The last [CO1, C2,
digit, is a checksum, which is calculated from the other nine digits using the Mark: 4]
following formula:

If the checksum is 10, the last digit is denoted as X according to the ISBN-10
convention. Write a program that prompts the user to enter the first 9 digits and
displays the 10-digit ISBN (including leading zeros). Your program should read
the input as an integer.

2. Design a class named Account that contains: [CO1, C3,


■ A private int data field named id for the account (default 0). Mark: 6]
■ A private double data field named balance for the account (default 0).
■ A private double data field named annualInterestRate that stores the
current interest rate (default 0). Assume all accounts have the same interest rate.
■ A private Date data field named dateCreated that stores the date when the
account was created.
■ A no-arg constructor that creates a default account.
■ A constructor that creates an account with the specified id and initial balance.
■ The accessor and mutator methods for id, balance, and annualInterestRate.
■ The accessor method for dateCreated.
■ A method named getMonthlyInterestRate() that returns the monthly interest
rate.
■ A method named getMonthlyInterest() that returns the monthly interest.
■ A method named withdraw that withdraws a specified amount from the
account.
■ A method named deposit that deposits a specified amount to the account.

3. a. Create a Main class “CheckAcc”. Inside the main method of the Main class [CO1, C3,
create n number of objects of the Account class. Mark: 10]

b. Now create a static method inside the Main class “ Boolean


CompareTo(Account a1, Account a2)” which will take any two objects of
Account type and return true if annualInterestRate of the two objects are the
same and return false otherwise.

Page 1 of 2
c. Now create a static method inside the Main class “ Boolean Equals ( Account
a1, Account a2)” which will take any two objects of Account type and return
true if the balance of the two objects are the same and return false otherwise.

d. Before executing the operation mentioned in 3(a), if we declare the balance


variable of the Account class as a static variable then what will be the impact
of these two objects? Explain with your own words.

e. Is it possible to call the Account (int id, double balance ) constructor from the
Account ()constructor? If yes then please write that specific part of the code
where we can call Account (int id, double balance ) from Account ().

4. Write a java program that will take a text as input and convert the text into tokens. [CO1, C3,
Sample output is given below: Mark: 4]
Input: I love java programming.
Output: I
love
java
programming.

5. Consider the following marks of Mid1, Mid2. Final, lab, and quiz exam of five [CO1, C3,
students. Mark: 6]

Name Mid1 Mid2 Final Lab Quiz


Aditri 20 15 8 14 12
Sammyo 10 19 12 5 14
Nandan 15 14 4 12 10
Riad 9 8 20 6 14
Rayan 14 20 14 20 15

Write a program in Java that uses the above-mentioned dataset. Use a method
named processExamResult() that takes data of a particular exam and prints the
name of the student who obtained the highest and lowest marks in the exam.
Sample output is given below

Mid1-Highest: Aditri Lowest: Riad


Mid2-Highest: Sammyo Lowest: Riad
Final-Highest: Riad Lowest: Aditri
Lab-Highest: Rayan Lowest: Riad
Quiz-Highest: Rayan Lowest: Nandan

Page 2 of 2

You might also like