Categories
Java

JAVA: TO DO (1): (Metric Conversion Application ) Write an application that will

JAVA:
TO DO (1): (Metric Conversion Application ) Write an application that will assist the user with metric conversions. Your application should allow the user to specify the names of the units as strings(i.e., centimeters, liters, grams, and so on, for the metric system and inches, quarts, pounds, and so on, for the English system) and should respond to simple questions, such as
“How many inches are in 2 meters?”
“How many liters are in 10 quarts?”
————————————————————————————————————————————————————————-
Your application should recognize invalid conversions. For example, the question:
“How many feet are in 5 kilograms?”
is not meaningful because “feet” is a unit of length, whereas “kilograms” is a unit of mass.
————————————————————————————————————————————————————————-TO DO (2):
please write descriptions for (example attached): problem statement, user documentation, developer documentation, and source code (you probably won’t need to do this), you will need to add link/picture to Javadocs documentation and UML diagram.
*again, an explanation and steps of how and why the code is processed and done is a MUST
*do not COPY answers from other sources (chegg, coursehero, etc.), otherwise will request refund with proof

Categories
Java

JAVA: TO DO (1): (Metric Conversion Application ) Write an application that will

JAVA:
TO DO (1): (Metric Conversion Application ) Write an application that will assist the user with metric conversions. Your application should allow the user to specify the names of the units as strings(i.e., centimeters, liters, grams, and so on, for the metric system and inches, quarts, pounds, and so on, for the English system) and should respond to simple questions, such as
“How many inches are in 2 meters?”
“How many liters are in 10 quarts?”
————————————————————————————————————————————————————————-
Your application should recognize invalid conversions. For example, the question:
“How many feet are in 5 kilograms?”
is not meaningful because “feet” is a unit of length, whereas “kilograms” is a unit of mass.
————————————————————————————————————————————————————————-TO DO (2):
please write descriptions for (example attached): problem statement, user documentation, developer documentation, and source code (you probably won’t need to do this), you will need to add link/picture to Javadocs documentation and UML diagram.
*again, an explanation and steps of how and why the code is processed and done is a MUST
*do not COPY answers from other sources (chegg, coursehero, etc.), otherwise will request refund with proof

Categories
Java

a. Write a Java program that is reading from the keyboard a value between 111 an

a. Write a Java program that is reading from the keyboard a value between 111 and 900 and is printing on the screen the prime factors of the number.
Your program should use a cycle for validating the input (if the value typed from the keyboard is less than 111 or bigger than 900 to print an error and ask the user to input another value).
Also the program should print the prime factors in the order from smallest to biggest.
For example,
for the value 128 the program should print 128=2*2*2*2*2*2*2
for the value 122 the program should print: 122=2*61
b. change the program at a. to print one time a prime factor but provide the power of that factor:
for the value 128 the program should print 128=2^7
for the value 122 the program should print: 122=2^1*61^1

Categories
Java

Question One Write a complete Java program that performs the following tasks: 1.

Question One
Write a complete Java program that performs the following tasks:
1. Take 9 integer inputs from the user and store them in an array (arr1). The elements of the arr1 must be your student id.
2. Print the elements of the array.
3. Copy all the elements in another array (arr2) but in reverse order and print them on screen using enhanced for loop.
4. Generate a random number between 1 & 6 and store it in a variable num.
5. Find and print the following in the arr 2.
a. Numbers that are greater than num
b. Numbers that are smaller than num
Note:
The class name of your Java program must be your first name.
Your answer should have the code as text as well as the screenshot of the program output (using your own name) as a part of your answer. Otherwise, zero marks will be awarded.
Typical run of the program
Question Two
Write a java program that prints student’s name, grades and GPA. You must do the following requirements:
1. Create three methods:
a. First method to accept and print your first, last name, and GPA.
b. Second method to accept and print your grades of three courses (type: int)
c. Third method to overload the second method (types: double). The method must print your grades.
2. Call the three methods you created above in your main method.
3. Create a method without parameters that would return only your GPA. The method should be named with your last name followed by GPA (e.g., AlwalledGPA()).
4. Declare a double variable that holds the returned value of the last method you created.
5. Print the value of your GPA variable.
Note:
The class name of your Java program must be your first name.
Your answer should have the code as text as well as the screenshot of the program output (using your own name) as a part of your answer. Otherwise, zero marks will be awarded.
Typical run of the program
Question Three
1. Create a class Course to describe a course according to the following requirements: A course has three attributes: courseName, courseCode, fees.
a. Create a constructor without parameters to initialize all the instance variables to default values (0 for numbers and “” for a string).
b. Create a constructor to initialize all the attributes to specific values.
c. Add all setter and getter methods
2. Create a tester class with the main method. The tester class must be named using your first and last name. In this class performs the following:
a. Create a course object c1 using the default constructor.
b. Create a course object c2 with the following information: courseName =” object oriented programing”, courseCode = “CS230” , fees = a value from your choice.
c. Change the course fees of c2 to your age.
d. Print the course information of c2 using getter methods
Note:
Your answer should have the code as text as well as the screenshot of the program output (using your own name) as a part of your answer. Otherwise, zero marks will be awarded.
Typical run of the program

Categories
Java

Question One Write a complete Java program that performs the following tasks: 1.

Question One
Write a complete Java program that performs the following tasks:
1. Take 9 integer inputs from the user and store them in an array (arr1). The elements of the arr1 must be your student id.
2. Print the elements of the array.
3. Copy all the elements in another array (arr2) but in reverse order and print them on screen using enhanced for loop.
4. Generate a random number between 1 & 6 and store it in a variable num.
5. Find and print the following in the arr 2.
a. Numbers that are greater than num
b. Numbers that are smaller than num
Note:
The class name of your Java program must be your first name.
Your answer should have the code as text as well as the screenshot of the program output (using your own name) as a part of your answer. Otherwise, zero marks will be awarded.
Typical run of the program
Question Two
Write a java program that prints student’s name, grades and GPA. You must do the following requirements:
1. Create three methods:
a. First method to accept and print your first, last name, and GPA.
b. Second method to accept and print your grades of three courses (type: int)
c. Third method to overload the second method (types: double). The method must print your grades.
2. Call the three methods you created above in your main method.
3. Create a method without parameters that would return only your GPA. The method should be named with your last name followed by GPA (e.g., AlwalledGPA()).
4. Declare a double variable that holds the returned value of the last method you created.
5. Print the value of your GPA variable.
Note:
The class name of your Java program must be your first name.
Your answer should have the code as text as well as the screenshot of the program output (using your own name) as a part of your answer. Otherwise, zero marks will be awarded.
Typical run of the program
Question Three
1. Create a class Course to describe a course according to the following requirements: A course has three attributes: courseName, courseCode, fees.
a. Create a constructor without parameters to initialize all the instance variables to default values (0 for numbers and “” for a string).
b. Create a constructor to initialize all the attributes to specific values.
c. Add all setter and getter methods
2. Create a tester class with the main method. The tester class must be named using your first and last name. In this class performs the following:
a. Create a course object c1 using the default constructor.
b. Create a course object c2 with the following information: courseName =” object oriented programing”, courseCode = “CS230” , fees = a value from your choice.
c. Change the course fees of c2 to your age.
d. Print the course information of c2 using getter methods
Note:
Your answer should have the code as text as well as the screenshot of the program output (using your own name) as a part of your answer. Otherwise, zero marks will be awarded.
Typical run of the program

Categories
Java

It is your responsibility to check and make sure that you have uploaded both the

It is your responsibility to check and make sure that you have uploaded both the correct files.
Zero mark will be given if you try to bypass the SafeAssign (e.g. misspell words, remove spaces between words, hide characters, use different character sets, convert text into image or languages other than English or any kind of manipulation).
Email submission will not be accepted.
You are advised to make your work clear and well-presented. This includes filling your information on the cover page.
You must use this template, failing which will result in zero mark.
You MUST show all your work, and text must not be converted into an image, unless specified otherwise by the question..
The work should be your own, copying from students or other resources will result in ZERO mark.
Use Times New Roman font for all your answers.
Please write the codes correctly and do not copy or plagiarize the codes.

Categories
Java

Question One Write a complete Java program that performs the following tasks: 1.

Question One
Write a complete Java program that performs the following tasks:
1. Take 9 integer inputs from the user and store them in an array (arr1). The elements of the arr1 must be your student id.
2. Print the elements of the array.
3. Copy all the elements in another array (arr2) but in reverse order and print them on screen using enhanced for loop.
4. Generate a random number between 1 & 6 and store it in a variable num.
5. Find and print the following in the arr 2.
a. Numbers that are greater than num
b. Numbers that are smaller than num
Note:
The class name of your Java program must be your first name.
Your answer should have the code as text as well as the screenshot of the program output (using your own name) as a part of your answer. Otherwise, zero marks will be awarded.
Typical run of the program
Question Two
Write a java program that prints student’s name, grades and GPA. You must do the following requirements:
1. Create three methods:
a. First method to accept and print your first, last name, and GPA.
b. Second method to accept and print your grades of three courses (type: int)
c. Third method to overload the second method (types: double). The method must print your grades.
2. Call the three methods you created above in your main method.
3. Create a method without parameters that would return only your GPA. The method should be named with your last name followed by GPA (e.g., AlwalledGPA()).
4. Declare a double variable that holds the returned value of the last method you created.
5. Print the value of your GPA variable.
Note:
The class name of your Java program must be your first name.
Your answer should have the code as text as well as the screenshot of the program output (using your own name) as a part of your answer. Otherwise, zero marks will be awarded.
Typical run of the program
Question Three
1. Create a class Course to describe a course according to the following requirements: A course has three attributes: courseName, courseCode, fees.
a. Create a constructor without parameters to initialize all the instance variables to default values (0 for numbers and “” for a string).
b. Create a constructor to initialize all the attributes to specific values.
c. Add all setter and getter methods
2. Create a tester class with the main method. The tester class must be named using your first and last name. In this class performs the following:
a. Create a course object c1 using the default constructor.
b. Create a course object c2 with the following information: courseName =” object oriented programing”, courseCode = “CS230” , fees = a value from your choice.
c. Change the course fees of c2 to your age.
d. Print the course information of c2 using getter methods
Note:
Your answer should have the code as text as well as the screenshot of the program output (using your own name) as a part of your answer. Otherwise, zero marks will be awarded.
Typical run of the program

Categories
Java

Hello, please do below task as per given guidelines Write the two methods inter

Hello,
please do below task as per given guidelines
Write the two methods interp and maxargs described on page 12 of the textbook. Use the following class as a template. Please use customary Java style conventions. Package names should be lower case, class names should be upper case.

Categories
Java

import javax.swing.JOptionPane; public class DTRFacility { public static void m

import javax.swing.JOptionPane;
public class DTRFacility
{
public static void main(String args[])
{
String empname[]={“Christopher”,”Judilla”,”Julius”};
String emplvl[]={“Level 1″,”Level 2″,”Level 3”};
String empID[]={“A-0001″,”A-0002″,”A-0003″};
int tran=0, fnd=0;
String id=””;
for(int i=0;i<=i;i++)
{
tran=Integer.parseInt(JOptionPane.showInputDialog(null,"Transactions:n1.DTRn2.Exit"));
if(tran==1)
{ //start tran 1
id=JOptionPane.showInputDialog(null,"Enter Employee ID:");
for(int x=0;x<=2;x++)
{ //start loop x
if(id.equals(empID[x]))
{
fnd=1;
JOptionPane.showMessageDialog(null,"Employee InformationnEmployee ID:"+empID[x]+"nEmployee Name:"+empname[x]+"nEmployee Level:"+emplvl[x]);
}
} //end loop x
if(fnd==0)
{
JOptionPane.showMessageDialog(null,"Invalid ID");
}
} //end tran 1
else //this else is for transaction 2 or any number except 1
{
JOptionPane.showMessageDialog(null,"System Close!");
System.exit(0);
}
}
}
}

Categories
Java

Program 1 – Add the two smallest elements of a given array. Implementation 1 //@

Program 1 – Add the two smallest elements of a given array.
Implementation 1
//@ requires a.length > 1;
//@ assignable nothing;
//@ ensures (forall int i; 0 <= i && i < a.length; a[result] <= a[I]);
//@ ensures 0 <= result && result 0){
if(a[index]
0){
if(index!=x){
if(a[index] < a[smallest] && a[x]
1 && x == getSmallest1(a) && y == getSmallest2(a, x);
//@ assignable nothing;
//@ ensures result == a[x]+a[y];
int sumTwoSmallest(int[] a,
int x, int y){
return a[x]+a[y];
}
Implementation 2
int sumTwoSmallest(int[] a){
int smallest1, smallest2;
if(a[0] < a[1]){
smallest1 = a[0]
;
smallest2 = a[1];
}
else{
smallest1 = a[1];
smallest2 = a[0];
}
int index = 0;
while(index < a.length){
if(a[index] < smallest1){
smallest2 = smallest1;
smallest1 = a[index];
}elseif(a[index] < smallest2 && a[index] ! = smallest1){
smallest2 = a[index];
}
index = index+1;
}
return smallest1+smallest2;
}
Program 2 – Find the even element of a given array.
int searchEven(int[] a){
int num = -1;
int index = 0;
while(index < a.length){
if(a[index] % 2 == 0){
num = a[index];
}
index = index+1;
}
return num;
}
Program 3 – Find the largest even number in the given array.
int searchLargestEven(int[] a){
int num = -1;
int index = 0;
while(index
num ){
num = a[index];
}
index = index+1;
}
return num;
}
For all of the above programs provide
Exercise 3 (100 points) their pre and post conditions
– 15 points for precondition of each program
– 15 points for postcondition of each program
– 10 points for correct specification (as determined by OpenJML)
Exercise 4 (100 points) and their loop invariants and termination terms.
– 15 points for loop invariant of each program
– 15 points for termination term of each program
– 10 points for correct specification (as determined by OpenJML)
Note: The points for correct specification will be awarded only if OpenJML proves that
the program is correct with respect to the specification. I will test it with your given files.
Hint: You can define new methods in Java as an auxiliary methods to be used in your
specification. These methods must be pure functions, i.e. with no side effects. These
auxiliary functions have to be specified in OpenJML