티스토리 뷰

1. Update the Snake and Ladder programme to make two players (red, purple) to compete each other. The program outcomes should include who won and how he or she won the game. There is a trap in the 99th square, so if a player lands on the 99th square, he or she has to start over the game.

(한 사람이 이기는 순간 게임이 끝나도록 하면 됩니다. snake and ladder game은 인터넷에서 금방 아실 수 있어요!)

 

 

 

 

2. Given three arrays A, B, initialised with some non-sorted integers, and C with a size equal to the sizes of A and B put together, you are asked to write a Java programme to combine A and B elements into the array C and print all the elements in C. C is not supposed to be sorted. (N.B The same number in both lists should appear in the list C only once.)

 

int A[] = {23, 34, 12, 5, 64, 7, 91};

int B[] = {45, 65, 34, 70, 4, 93};

int C[];

 

 

3. With the two arrays above, you are asked to write a Java programme to combine A and B elements into the array C such that C is also sorted, and print all the elements in C.

 

 

 

4. A friend of yours wants to write a programme to keep track of his debts. He has a file containing the list of his friends name, one per line, and has started writhing a Java programme that reads the file, display the names one at a time and prompts for the amount of overdue, then displays the total debt and writes to another file the names with the amounts due to them.

 

Here is a sample output of the main program. Keyboard input is given in bold:

 

Please enter the input file name: myfriends.txt

File Read.

Please enter the amounts due for each person.

John > $25.00

Jane > $50.00

 

Total debt is $75.00

Please enter the output file name: mydebtlist.txt

File written

 

 

 

5. Explain the following concepts with simple examples in Java.

5.1 Polymorphism

5.2 Inheritance

5.3 this, super

5.4 What is difference between function "overriding" and "overloading"

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함