IT 401 Business Computer Languages Java programs

Availability: Out of stock

Regular Price: $15.00

Special Price: $12.00

IT 401 Business Computer Languages Java program Q1

Double click on above image to view full picture

Zoom Out
Zoom In

More Views

Quick Overview

IT 401 Business Computer Languages Java programs


Q1.:
Write a complete Java program (code + screenshot of output) that performs the following:
Given the following marks of a student: 84, 72, 91, 61, 69, 77
• Create an array (marksArray) to include all of student marks.
• Create a method (smallest) to find the smallest mark and print its value.
• Create a method (average) to compute the average of a student marks and return its value to the caller.
• Create a new array (backup) to copy all marks of the current array (marksArray). (Hint: use Arrays.copyOf method)
Answer:


Q2.:
Write a complete Java program (code + screenshot of output) that performs the following:
• Create an array list and add the following items: [Toyota, Nissan, Mercedes, Mazda].
• Print out the existing items of the array list on the screen.
• Replace the item "Mercedes" with "Kia", and remove the item "Mazda".
• Print out the current array list items in the opposite order.
Answer:


Q3.:
Write a complete Java program (code + screenshot of output) that performs the following:
• Write a while loop that reads integer values entered by user.
• Stop when a user enters any non-integer value.
• Compute the sum of all entered values that are greater than Zero and print the result on the screen.
Answer:


Q4.:
Each of the following Java code contains one or more errors. Find the error(s) and modify the code so that it will work properly.
# Original Code Correct Code
1. int[] values= values [10];
for (int i = 0; i <= 10; i++)
  {
     values [i] = i * i;
  } 


2. int count= -10;
while (count<0)
 {
   System.out.println(count);
 } 


3. 
for (double i : values)
 {
   Sum = sum + values [i];
   i++;
 }
 
4. int fractions[] = [2.8, 5.5, 4.6]; 


5. ArrayList<int> arr = new ArrayList();
arr.add(5);
System.out.println(arr.length); 


6. for (int i = 0; i < arrSize; i++)
{
  System.out.println(values);
}

Details

IT 401 Business Computer Languages Java programs

Q1.:
Write a complete Java program (code + screenshot of output) that performs the following:
Given the following marks of a student: 84, 72, 91, 61, 69, 77
• Create an array (marksArray) to include all of student marks.
• Create a method (smallest) to find the smallest mark and print its value.
• Create a method (average) to compute the average of a student marks and return its value to the caller.
• Create a new array (backup) to copy all marks of the current array (marksArray). (Hint: use Arrays.copyOf method)
Answer:

Q2.:
Write a complete Java program (code + screenshot of output) that performs the following:
• Create an array list and add the following items: [Toyota, Nissan, Mercedes, Mazda].
• Print out the existing items of the array list on the screen.
• Replace the item "Mercedes" with "Kia", and remove the item "Mazda".
• Print out the current array list items in the opposite order.
Answer:

Q3.:
Write a complete Java program (code + screenshot of output) that performs the following:
• Write a while loop that reads integer values entered by user.
• Stop when a user enters any non-integer value.
• Compute the sum of all entered values that are greater than Zero and print the result on the screen.
Answer:

Q4.:
Each of the following Java code contains one or more errors. Find the error(s) and modify the code so that it will work properly.
# Original Code Correct Code
1. int[] values= values [10];
for (int i = 0; i <= 10; i++)
  {
     values [i] = i * i;
  } 

2. int count= -10;
while (count<0)
 {
   System.out.println(count);
 } 

3. 
for (double i : values)
 {
   Sum = sum + values [i];
   i++;
 }
 
4. int fractions[] = [2.8, 5.5, 4.6]; 

5. ArrayList<int> arr = new ArrayList();
arr.add(5);
System.out.println(arr.length); 

6. for (int i = 0; i < arrSize; i++)
{
  System.out.println(values);
}

Product Tags

Use spaces to separate tags. Use single quotes (') for phrases.