[Solved] CSE111 Lab 9

$25

File Name: CSE111_Lab_9.zip
File Size: 113.04 KB

SKU: [Solved] CSE111 Lab 9 Category: Tag:
5/5 - (1 vote)

Study Hint Folder

  • Study given codes in Task01 and complete it

Run the program and play with it for a while. Once you understand how the program is working, start with the next paragraph.

once sorting example for number (mark) and another for string (ID) was done for you. Learn from that and write codes for sorting by section and name in respective methods.

  • For Task1, Generate javadoc like shown in the doc folder inside the Hint folder.

Help: http://www.drjava.org/docs/user/ch10.html

http://www.oracle.com/technetwork/java/javase/documentation/index137868.html#format

  • Complete the given Task03.java file using Scanner Use the last constructor from

https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html

  • Complete the given Task03.java file using StringTokenizer.

Hint:

http://www.kodejava.org/examples/15.html

https://docs.oracle.com/javase/8/docs/api/index.html?java/util/StringTokenizer.h tml

http://www.java-samples.com/showtutorial.php?tutorialid=236

  • Complete Task03 using split() Hint:

http://www.rgagnon.com/javadetails/java-0438.html http://www.devdaily.com/java/edu/pj/pj010006

Task 6) Happy Number

Source: http://online-judge.uva.es/p/v105/10591.html

Let the sum of the square of the digits of a positive integer S0 be represented by S1. In a similar way, let the sum of the squares of the digits of S1 be represented by S2 and so on. If Si = 1 for some i 1, then the original integer S0 is said to be Happy number. A number, which is not happy, is called Unhappy number. For example 7 is a Happy number since 7 -> 49 -> 97 -> 130 -> 10 -> 1 and 4 is an Unhappy number since 4 -> 16 -> 37 -> 58 -> 89 -> 145 -> 42 > 20 -> 4.

Input

The input consists of several test cases, the number of which you are given in the first line of the input. Each test case consists of one line containing a single positive integer N smaller than 109.

Output

For each test case, you must print one of the following messages:

Case #p: N is a Happy number.

Case #p: N is an Unhappy number.

Here p stands for the case number (starting from 1). You should print the first message if the number N is a happy number. Otherwise, print the second line.

Sample Input Output for Sample Input
37413 Case #1: 7 is a Happy number.Case #2: 4 is an Unhappy number.Case #3: 13 is a Happy number.

Problemsetter: Mohammed Shamsul Alam

International Islamic University Chittagong (IIUC)

Special thanks to Muhammad Abul Hasan

More Information:

  • http://en.wikipedia.org/wiki/Happy_number
  • http://mathworld.wolfram.com/HappyNumber.html

Command Line

Task 7

Learn the usage of following commands. [Take help from http://www.computerhope.com/msdos.htm or google]

Command Summary Highlights
cmd New command line / console in Windows Vista/7 Command prompt using botha. Dr. Java (in interaction pane)b. Console (cmd) 8.3 File naming system Handing paths with spaces using double quotes Write a java program that take 3 numbers from the user and prints their sum. Run your program using bothc. Dr. Javad. Console
command Old / Traditional command line / console in Windows XP and older systems.
cd Change Directory / Folder. Another similar command is chdir.
c: To go to C drive. Similarly, typing d: and pressing enter (8 ) will take you to D drive.
md Make/Create a Directory / Folder. Another similar command is mkdir.
set To view / change value of environment variables (?)
dir Show list of files and folders
javac To compile a java program and create class file
java To run a java program (class file)

Task 8

Complete the following program. You must use loop and arrayName.length for all current and future tasks in all labs. For example, following array name is a, so you should write a.length instead of 3 to stop the loop.

Program Expected Output
class Lab10Task02{public static void main(String[] args){ int a[]={10, 20, 30}; // write your code here}} 102030

Task 9

Modify your solution of Task 2 and complete the following program.

Program Expected Output
class Lab10Task03{public static void main(String[] args){String a[]={40, 50, 60};// write your code here}} 405060

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE111 Lab 9
$25