The screen shots is a must!! my professor uses the cmd command to compile and run programs. I need A’s on all the assignments. I need someone good and who know what they are doing and can meet my deadline. Do not worry about the last part on my assignments the reading execerise.
North Carolina A&T State University
ITT 240-01- Java
Fall – 2013
Assignment 1
· Due on Friday September 6th.
· Soft copy of the source code should be sent by e-mail or posted to Bb.
· Hard copy should be submitted in the class
· Output screen snapshots are also required
· Word document explains the answers for each part and instructions for running the programs.
· Please write your name and student ID at the top of the word document
Programming Exercise
(Creating, compiling, and running a Java program) Create a source file containing a Java program. Perform the following steps to compile the program and run it (see §1.9, “Creating, Compiling, and Executing a Java Program”):
1) Create a file named Welcome.java for Listing 1.1. You can use any editor that will save your file in text format.
2) Compile the source file.
3) Run the bytecode.
4) Replace “Welcome to Java” with “My first program” in the program; save, compile, and run the program. You will see the message “My first program” displayed.
5) Replace main with Main, and recompile the source code. The compiler returns an error message because the Java program is case-sensitive.
6) Change it back, and compile the program again.
7) Instead of the command javac Welcome.java, use javac welcome.java. What happens?
8) Instead of the command java Welcome, use java Welcome.class. What happens?
Reading Exercise
Read chapter 1. Propose 6 – 12 keywords. Compose 2 – 3 sentences to describe each chapter in a concise, comprehensive, and unambiguous manner.
PAGE
Dr. Naser El-Bathy
Page 1
North Carolina A&T State University
ITT 240-01- Java
Fall – 2013
Assignment 2
· Due on February 27th.
· Soft copy to be sent by e-mail or posted to Bb.
· Hard copy to be submitted at the beginning of the class
· Source file(s) is/are required
· Output screen snapshots also are required
· Word document explains the answers for each part.
· Please write your name and student ID at the top of the word document
EX 1:
Part a: Can the following conversions involving casting be allowed? If so, find the converted result:
char c = ‘A’;
i = (int)c;
float f = 1000.34f;
int i = (int)f;
double d = 1000.34;
int i = (int)d;
int i = 97;
char c = (char)i;
Part b: Show the output of the following statements:
System.out.println(“1” + 1);
System.out.println(‘1’ + 1);
System.out.println(“1” + 1 + 1);
System.out.println(“1” + (1 + 1));
System.out.println(‘1’ + 1 + 1);
Part c: Show the following output:
float f = 12.5F;
int i = (int)f;
System.out.println(“f is ” + f);
System.out.println(“i is ” + i);
Programming Exercises
EX 2:
(Payroll) Write a program that reads the following information and prints a payroll statement:
1) Employee’s name (e.g., Smith).
2) Number of hours worked in a week (e.g., 10).
3) Hourly pay rate (e.g., 6.75).
4) Federal tax withholding rate (e.g., 20%).
5) State tax withholding rate (e.g., 9%).
6) Use console input and output. A sample run of the console input and output is shown in Figure below:
Reading Exercise
Read chapter 2. Propose 6 – 12 keywords. Compose 2 – 3 sentences to describe each chapter in a concise, comprehensive, and unambiguous manner.
PAGE
Dr. Naser El-Bathy
Page 2
North Carolina A&T State University
ITT 240-01- Java
Fall – 2013
Assignment 4
· Due on Monday November 4th.
· Soft copy to be sent by e-mail or posted to Bb.
· Source file(s) is/are required
· Output screen snapshots also are required
· Word document explains the answers for each part.
· Please write your name and student ID at the top of the word document
Programming Exercises
EX 1:
What is wrong with the following program?
EX 2:
What is wrong in the following code?
Programming Exercises
EX 1:
(The MyInteger class) Design a class named MyInteger. The class contains:
· An int data field named value that stores the int value represented by this object.
· A constructor that creates a MyInteger object for the specified int value.
· A get method that returns the int value.
· Methods isEven(), isOdd(), and isPrime() that return true if the value is even, odd, or prime, respectively.
· Static methods isEven(int), isOdd(int), and isPrime(int) that return true if the specified value is even, odd, or prime, respectively.
· Static methods isEven(MyInteger), isOdd(MyInteger), and isPrime(MyInteger) that return true if the specified value is even, odd, or prime, respectively.
· Methods equals(int) and equals(MyInteger) that return true if the value in the object is equal to the specified value.
· A static method parseInt(int) that converts a string to an int value.
Draw the UML diagram for the class. Implement the class. Write a client program that tests all methods in the class.
EX 2:
(The Account class) Design a class named Account that contains:
· An int data field named id for the account (default 0).
· A double data field named balance for the account (default 0).
· A double data field named annualInterestRate that stores the current interest rate (default 0).
· A Date data field named dateCreated that stores the date when the account was created.
· A no-arg constructor that creates a default account.
· 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 withDraw that withdraws a specified amount from the account.
· A method named deposit that deposits a specified amount to the account.
Draw the UML diagram for the class. Implement the class. Write a test program that creates an Account object with an account ID of 1122, a balance of 20000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2500, use the deposit method to deposit $3000, and print the balance, the monthly interest, and the date when this account was created.
Reading Exercise
Read chapter 7. Propose 6 – 12 keywords. Compose 2 – 3 sentences to describe each chapter in a concise, comprehensive, and unambiguous manner.
PAGE
Dr. Naser El-Bathy
Page 1
North Carolina A&T State University
ITT 240-01- Java
Fall – 2013
Assignment 3
· Due on Wednesday October 9th.
· Soft copy to be sent by e-mail or posted to Bb.
· Source file(s) is/are required
· Output screen snapshots also are required
· Word document explains the answers for each part.
· Please write your name and student ID at the top of the word document
Programming Exercises
EX 1:
(Finding the smallest element) Write a method that finds the smallest element in an array of integers. Use {1, 2, 4, 5, 10, 100, 2, –22} to test the method.
EX 2:
(Increasing array size) Once an array is created, its size is fixed. Occasionally, you need to add more values to an array, but it is full. In such cases, you can create a new, larger array to replace the existing array. Write a method with the following header: public static int[] doubleCapacity(int[] list). The method returns a new array that doubles the size of the parameter list.
Reading Exercise
Read chapter 3. Propose 6 – 12 keywords. Compose 2 – 3 sentences to describe each chapter in a concise, comprehensive, and unambiguous manner.
PAGE
Dr. Naser El-Bathy
Page 1