Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Step 1: Create a class named FinalExam1 . Include appropriate comments using lin

ID: 3559960 • Letter: S

Question

Step 1:

Create a class named FinalExam1.

Include appropriate comments using line and block comments.

Create a line of code the when executed will display the output Final Exam for CIST 2371. Include appropriate comments throughout the code including your name, date, and step information. Save the program

Compile and correct any errors.

Example of output: Final Exam for CIST 2371

Step 2:

Create a class named FinalExam2.

The class will track the sale of Girl Scout cookies. The class should prompt a user to enter their name and the number of boxes of cookies they wish to purchase. Use the Scanner object and not dialog boxes to gather this information. Store the user information in the appropriate variable. Once the information is gathered from the user, calculate the total amount owed for the cookies. Each box of cookies costs $3.50.

The information displayed should contain the user name, number of boxes of cookies, and total amount owed.

Include appropriate comments throughout the code including your name, date, and step information. Save the program

Compile and correct any errors.

Example of output: John Brown purchased 4 boxes of cookies. The total amount owed is $14.00.


Step 3:

Create a class named FinalExam3.

The class should have data fields for account number, payment amount, and balance as well as the appropriate set and get methods.

Include a constructor method that contains no arguments.

Set the account number equal to 58965, payment amount to 659 and the balance to 9856.

Write the appropriate comments and save the program.

Compile and correct any errors.

Create a class named FinalExam4 to demonstrate that each method created in FinalExam3 works correctly.

The output should contain the account number, payment amount, and balance. Each item should appear on a separate line. Include a blank line between the outputs.

Create one instantiates object that tests the constructor. Once the information is information is gathered from FinalExam3s constructor, display the information.

Create a second instantiates object that test the set and get methods. Set the account number to 12345, the payment amount to 150, and the balance to 3000.

Create code to display the information gathered from the get methods.

Include appropriate comments throughout the code including your name, date, and step information. Save the code.

Compile and correct any errors.

Example of output:

The account number is: 58965

The payment amount is: 659

The balance is: 9856

The account number is: 12345

The payment amount is: 150

The balance is: 3000


Step 4:

Create a class named FinalExam5.

Prompt the user for two integers. Use dialog boxes to gather the information from the user.

Prompt the user to enter an option 1 4. See below for the definitions of the options.

Add the two integers

Subtract the second integer from the first

Multiply the integers

Quit the program, display Good Bye

Use a Switch structure to determine the course of action.

Display the results of the arithmetic.

Display an error message if the user enters an option other than 1 through 4.

Continue to prompt the user until the option of 4 has been entered.

Write the appropriate comments including your name, date, and step information. Save your code.

Compile and correct any errors.

Example of output:

Option 1: 1 plus 3 equal 4

Option 2: 4 minus 1 equal 3

Option 3: 1 times 4 equal 4

Option 4: Good Bye

Step 5:

Create a class named FinalExam6.

Using a for loop create code that prints all numbers 5 through 100 using increments of 5. Each number should be printed on a new line.

Write the appropriate comments including your name, date, and step information. Save and debug your code.

Compile and correct any errors.

Examples of program output:

(This is just a sample of the output)

5

10

15

20

Step 6:

Create a program FinalExam7 that demonstrates the append and insert methods.

Create a Stringbuffer variable then call a print method to print the StringBuffer.

Create the code to print have. Print the string.

Create code to add completed your to the end of the have string. Print the string.

Create code to add Congratulations to the beginning of the string created in Step 4. Print the string.

Create code to add final exam. to the end of the string created in Step 5. Print the string.

Create code to add you after Congratulations. Print the string.

Create code to add your name to the string created in Step 7 so that the statement reads, Congratulations Jane you have completed your final exam.

Write the appropriate comments including your name and the step number. Save the program.

Compile and correct any errors.

Example of output:

have

have completed your

Congratulations have completed your

Congratulations have completed your final exam.

Congratulations you have completed your final exam.

Congratulations Jane you have completed your final exam.


Step 7:

Be sure to compile and test all programs before submission. If any errors are found, correct and repeat this step.

Explanation / Answer

1. class FinalExam1 // Class one

{

public static void main(String arg[]) //THE MAIN METHOD

{

System.out.println("Final Exam for CIST 2371"); //THE PRINT FUNCTION

}

}

2.

import java.util.Scanner;
class FinalExam2 // Class two
{

public static void main(String arg[]) //THE MAIN METHOD

{
Scanner in = new Scanner(System.in); // Initiate a new Scanner

int boxes;

float cost;

System.out.println("Enter the number of cookie boxes bought : "); //To get the value of boxes from user.

boxes = in.nextInt();

cost=(float)(boxes*3.50); //CALCULATE

System.out.print("John Brown purchased boxes "+boxes);
System.out.println("of cookies. The total amount owed is $"+cost); //Printing cost

}
}

5.

class FinalExam6 // Class six

{

public static void main(String arg[]) //THE MAIN METHOD

{

for(int i=5;i<=100;i=i+5) //THE LOOP FROM 5 TO 100 INCEREMENTS BY 5 EVERY TIME

System.out.println(i); //THE PRINT FUNCTION

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote