IT Bachelor's Exam in Software Development, Autumn 2005, Exams of Software Development Methodologies

The instructions and questions for a bachelor's exam in information technology at cork institute of technology, focusing on software development. The exam includes questions on tax calculation, extending a bankaccount class, reading data from a file, and creating a simple calculator applet or frame. The document also covers topics such as object-oriented programming, inheritance, and overloading.

Typology: Exams

2012/2013

Uploaded on 03/25/2013

digvijay
digvijay 🇮🇳

4.4

(17)

185 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Cork Institute of Technology
Bachelor of Science in Computing in Information Technology
Support – Award
(National Diploma in Computing in Information Technology
Support – Award)
(NFQ – Level 7)
Autumn 2005
Software Development
(Time: 3 Hours)
Instructions
Answer FOUR questions.
All questions carry equal marks.
Examiners: Mrs. G.
MacSweeney
Mr. E.A. Parslow
Mr. P. O Connor
Dr. D. Chambers
Q1.
Write an applet which prompts a user to enter his / her name and their annual salary. The program
should calculate and display their tax for the year. Tax is calculated as follows:
salary <= €5000 tax = €0.0
€5000 =< salary <= € 9000 tax = 20% of (salary - €5000)
salary >= €9000 tax = €800 + 40% of (salary - €9000)
(25 Marks)
pf3
pf4
pf5

Partial preview of the text

Download IT Bachelor's Exam in Software Development, Autumn 2005 and more Exams Software Development Methodologies in PDF only on Docsity!

Cork Institute of Technology

Bachelor of Science in Computing in Information Technology

Support – Award

(National Diploma in Computing in Information Technology

Support – Award)

(NFQ – Level 7)

Autumn 2005

Software Development

(Time: 3 Hours)

Instructions Answer FOUR questions. All questions carry equal marks.

Examiners: Mrs. G. MacSweeney Mr. E.A. Parslow Mr. P. O Connor Dr. D. Chambers Q1. Write an applet which prompts a user to enter his / her name and their annual salary. The program should calculate and display their tax for the year. Tax is calculated as follows:

salary <= €5000 tax = €0.

€5000 =< salary <= € 9000 tax = 20% of (salary - €5000)

salary >= €9000 tax = €800 + 40% of (salary - €9000)

( 25 Marks )

Consider the following simplified BankAccount class:

class BankAccount { public BankAccount() { } private double balance = 0;

public void displayBalance() {

System.out.println(balance); } public void deposit(double amount) { balance = balance + amount; } public void withdraw(double amount) { balance = balance - amount; } }

What change needs to be made to extend this class.

Write a SavingsAccount class by extending BankAccount which includes two new methods:

calculateInterest() which calculates the interest on the current balance addInterest() which adds the interest to the balance.

Add whatever other data items you think are necessary to write these methods

Override the withdraw() method to prevent the balance going into the red i.e. the balance should never be less than 0.0.

Write a short program to demonstrate how the SavingsAccount() class may be used.

Suggest how you could prevent the BankAccount class from being instantiated

Suggest another possible extension of the BankAccount class. Suggest some method prototypes it might have. ( 25 Marks )

(b) Using this class, write a program which reads a list of twenty people (i.e. twenty surnames, twenty forenames and twenty ages) from a text file (“people.txt”) and stores them in an array. The start of the program is as follows:

import java.io.*; public class MyArray { public static void main( String args[] ) throws IOException {

File f = new File("people.txt"); FileInputStream fs = new FileInputStream(f); InputStreamReader isr; BufferedReader fileInput; isr = new InputStreamReader(fs); fileInput = new BufferedReader(isr); (c) Change the program to search for and display the youngest person in the file.

( 25 Marks )

Q4.

Write an applet or a frame which displays the canvas for a simple calculator as follows:

In your answer, include appropriate layout managers and panels. You do not need to include the ActionListener interface. ( 25 marks )

A library consists of books and borrowers. An efficient library system must take account of the

details each borrower and each book. Some of the information that is recorded includes the title of

the book the author, the name of the person borrowing the book, etc.

a) Write a (^) Book class that records (^) author and (^) title and can return (^) author and title. ( 6 marks )

b) Write a Borrower class which records name and idNumber and can return name and idNumber. ( 6 marks )

c) Write a LibraryTransaction class which contains the method lendBookDetails() – this displays details of both the borrowed book and the borrower. ( 6 marks )

d) A borrower Mary Adams (idNumber - A00001 ) borrows the book Ivanhoe by Walter Scott. Write a short program which uses the lendBookDetails() method to display this information. ( 7 marks )