Create a program that gets values as CMD args as follows, a person's name, year of birth and gender. The program then prints a message as follows:[HINT: if the person is male then the program uses Mr otherwise use Ms]
Sample 01:
Java Lab01_Task04 John 1999 M
Output
Good Mr John, you are 21 years old
Create a program that will convert the input inch(es) into its equivalent centimeters. One inch is equivalent to 2.54cms. Then display the result.
Even Out
by CodeChum Admin
You know, I was lying when I said the last time that numbers associated with 3 are my favorite, because the one I actually like the most in the world are even numbers! But to make things harder for you, you have to pick the even numbers from a range of two given numbers. Ha!
Now, let's try this one more time!
Instructions:
Input two integers in one line, separated by a space. The first integer shall represent the starting point, and the other, the ending point.
Print out all even numbers that are within the range of the starting and ending point (inclusive or including the ending point).
Input
A line containing two integers separated by a space.
5·10
Output
A line containing integers separated by a space.
6·8·10
Even Out
by CodeChum Admin
You know, I was lying when I said the last time that numbers associated with 3 are my favorite, because the one I actually like the most in the world are even numbers! But to make things harder for you, you have to pick the even numbers from a range of two given numbers. Ha!
Now, let's try this one more time!
Instructions:
Input two integers in one line, separated by a space. The first integer shall represent the starting point, and the other, the ending point.
Print out all even numbers that are within the range of the starting and ending point (inclusive or including the ending point).
Input
A line containing two integers separated by a space.
5·10
Output
A line containing integers separated by a space.
6·8·10
Factorials
by CodeChum Admin
For those of you who may not now, a factorial is a product of multiplying from 1 until the number. Now, you must make a program that will accept an integer and then print out its factorial using loops.
Are you up for this task?
Instructions:
Input a positive integer.
Using a for() loop, generate the factorial value of the integer and print out the result.
Tip #1: Factorials work like this: Factorial of 5 = 1 * 2 * 3 * 4 * 5
Tip #2: There's a special case in factorials. The factorial of 0 is 1.
Input
A line containing an integer.
5
Output
A line containing an integer.
120
Visit any institution in Sierra Leone Government or Private and study their functions or services and develop a java console application that either overhaul or automate it.
Implement the following java concept in your solution and highlight in your documentation or code where you did it:
1. Class and Object
2. File and Stream
3. Exception Handling
Outcomes
On successful completion of this project, students will be able to:
● Analyse, design, and develop application using Java.
● Understand and implement some basic java concepts and principles.
● Identify real life problems and find technological solution to them.
develop a java console application that either overhaul or automate it.
Implement the following java concept in your solution and highlight in your documentation or code where you did it: and explain the steps
1. Class and Object
2. File and Stream
3. Exception Handling
Create a program that gets values as CMD args as follows, a person's name, year of birth and gender. The program then prints a message as follows:[HINT: if the person is male then the program uses Mr otherwise use Ms]
Sample 01:
Java Lab01_Task04 John 1999 M
Output
Good Mr John, you are 21 years old
Sample run 1:
Enter two numbers: 2 8
Output:
Even numbers: 2 4 6 8
Odd numbers: 3 5 7
Sum of even numbers = 20
Product of odd numbers = 105
Correct the code:-
public class DLL {
private Node start;
private Node end;
int count;
public DLL() {
start = end = null;
count=0;
}
public void insertAtstrat (Data d) {
if (count == 0) {
Node tn = new Node(d,null,null);
start = end = tn;
}
else {
Node tn = new Node (d,start,null);
start.prev = tn;
start (tn);
count++;
}
}
public void insertAtend (Data d) {
if (count == 0) {
insertAtend(d);
}
else {
Node tn = new Node(d,null,end);
end.next = tn;
end = tn;
count++;
}
public void insertAt(Data d, index i) {
if (count ==0 || index == 0);
insertAtstart(d);
else if (i >= count);
insertAtend(d);
else {
Node temp = start;
for (a = 1);
temp = temp.Node;
Node tn = new Node(d, temp.next, temp);
temp.next = tn;
temp = tn.next;
temp.prev = tn;
}
}
}
}
public class Node {
Data d;
Node next;
Node prev;
public Node (Data d,Node n,Node p) {
d = new Data();
next = n;
prev = p;
}