Categories
Java

Please review the document and add your answers in a separate document

The attached document consists of 30 multiple choice questions
Please review the document and add your answers in a separate document
The document should include the Question number, and your answer along with the option selected (A or B or C or D)

Categories
Java

I need someone to check on my java project codes-blackjack game and my hand class.

I need someone to check on my Java Project codes-Blackjack game and my Hand class.
Do I need to modify anything or correct any mistakes in my codes?
I used Replit as a compiler. (I can just upload 4 coding screenshots, and I will upload more Java files like deck class, hand class, and card class later.)

Categories
Java

When it gets to the right option, set the fruit description and the price.

A. F22 – Quantity Discount App (if)
Write a program to display the discount based on the number of products purchased. This function would work well in a system calculating a large order and offering a quantity discount. Create an integer to store the number of products ordered. Use Scanner (pg 85) to ask the user for the number of products ordered. Use an if-else-if test (pg 128) to find the correct percent. If the count is less than five, the percentage is 0%. You’ll need to use relational operators (pg 113) and might also use logical operators (pg 134) in your if tests. Print the result using println (pg 33). Name your program the 5 characters of last name + first initial + +_J2A (ex: HardyL_J2A).
5 to 9 = 10%
10 to 19 = 15%
20 to 29 = 20%
30 or more = 25%
Sample output:
You get a 25% discount for ordering 50 items
Hints/Tips
If you do the test backward, starting with 30, you can do if quantity > 30 … then work your way down between 5 and 9, you will end with an else discount is zero.
You can use println to print each message in the if test. Ex:
if quantity > 30
out.println(“Your discount is 25%”);
else if

else
System.out.println(“You do not qualify for a discount”);
Be sure to test each if condition. (Ex: if the quantity is 10, the discount should be 15%).
This took me 17 minutes. (Don’t let this fool you that it’s easy. I’ve been programming for 38 years. I show you this to give you a point of reference so that if it takes me 17 minutes and you 34, you might be able to double my time on future assignments. Or, it might take you 2 hours. Anytime you get stuck, it can take quite a while to figure it out. Often, it’s something simple like a missing or misplaced semi-colon. And, it might take you less time because I updated the assignment with tips as I wrote my program).
Rubric
Doesn’t use if-else-if -100% (this is the point of the assignment)
Doesn’t display the results -20%
Doesn’t display the correct results -10%
Doesn’t use Scanner -10%
Doesn’t create the int variable -20%
B. F22 – Fruit Stand Prices App (switch)
Write a program to find the price of selected fruits. Create a char variable (pg 50) to store the fruit selection. Create a double variable to store the price and a String to store the name of the selected fruit. Use JOptionPane to ask which fruit they want using the letters below. Since JOptionPane returns a String, you need to use charAt(0) (pg 74) to convert the String to a char. You can use n in JOptionPane to create a meaningful message for the user to select a fruit option. If the option selected is not valid, display a message saying so. Use the Switch statement (pg 150) to find the price based on the char entered by the user. Display the fruit description and the price using
Please enter the letter for the fruit option to purchase:
Watermelon – $8
Basket of Peaches – $6
Basket of Apples – $4
Cantaloupe – $2
Honeydew Melon – $2
Basket of Grapes – $3
Basket of Cherries – $6
Sample output:
You selected c, Cantaloupe for $2
Hints/Tips
Even though it’s possible to use an integer for the price, we shouldn’t code it that way because a price in the future might include cents (ex: $2.50).
JOptionPane (all hardcoded – Strings, without variables) should look something like the above list.
Switch should check for the option selected. When it gets to the right option, set the fruit description and the price. Ex:
Case ‘c’
fruitDesc = “Cantaloupe”
price = 2.00
After the variables are set, display the selected fruit and price (see sample output)
If an invalid option is selected, set the price to 0.00, then test to see if the price is zero. If it is, display a message that it’s an invalid option; otherwise, display the results
Test all your options, including a bad option. Keeping an application from breaking is a big part of programming.
Don’t forget to put System.exit(0) when using JOptionPane.
This program took me 27 minutes.
Rubric
Doesn’t use switch -100% (this is the point of the assignment)
Incorrectly uses switch -20%
Doesn’t use JOptionPane -10%
Doesn’t display the message -20%
C. F22 – Movie Ticket Price App (switch) (5 points)
Write a program to calculate the movie price. You need three variables, the ticket type (int), the number of tickets (int), and the price to the customer (double). Use JOptionPane to ask the user for the ticket type, then the number of tickets. Use switch to determine which ticket type was selected. Based on the number of tickets, calculate the cost as price times the number of tickets times 8.5% tax. Use printf (pgs 160-171, esp pg 163) or JOptionPane with format (pg 172) to print the message.
Child = $2
Student = $7
Adult = $12
Senior = $8
Sample output:
You bought 4 adult tickets for a price of $52.08
Hints/Tips
In Java, 8.5% is .085 when you do the math.
Remember that JOptionPane always returns a String, so you need to use Parse (pg 96) to convert the String to an integer.
When using printf, you must put the dollar sign in the hardcoded string part of the message. It’s not part of the number format, though it looks like it because it’s next to it.
If you use JOptionPane to display the message, you must use String.format (pg 172) to format the price. It has the same rules as printf, but it’s necessary if you do not use System.out.printf.
Don’t forget that when you have an open parenthesis, you need a close parenthesis. Also, you can embed statements, ex:
double price = Double.parseDouble(JOptionPane.showInputDialog(“Price?”));
You can use literals for the ticType and print them in the message for each case (in the switch statement), or you can store the ticket type and only have one message to display the purchase price (outside the switch statement).
Don’t forget to put System.exit(0) when using JOptionPane.
This program took me 18 minutes.
Rubric
Doesn’t use switch -100% (this is the point of the assignment)
Doesn’t use Parse -10%
Doesn’t do the math correctly -15%
Doesn’t use JOptionPane to get the info from the user -10%
Doesn’t display the results -20%
Doesn’t create the variables -20%
D. F22 – Cable Company Help Desk App (nested if)
Write a program to guide a cable company’s tech support team through resolving problems. You need one variable to store the response for whether it worked. It should accept a Yes or No value. Use JOptionPane to tell the tech what to do based on the outline below. If the action didn’t fix the problem, give the next command, then ask if that fixed it. The if tests should be indented as the outline is. There are four different actions for the customer to perform. If the action fixes the problem, then exit the if statement. Don’t forget to use equals (pg 142) when comparing strings. If it doesn’t fix the problem, then do the next action.
Reboot control box
Didn’t workCheck connectionDidn’t workHit Reset ButtonDidn’t workMake appointment for service call with technician
Hints/Tips
Be sure to indent the ifs for ease of maintenance
Logic would look something like this:
JOptionPane (“Reboot”)
JOptionPane (“Did it fix it”)
if (!result.equalsIgnoreCase(“Yes”))
{
JOptionPane (“Check Connection”)
JOptionPane (“Did it work”
if (!result.equalsIgnoreCase(“Yes”)
}
Use the equalsIgnoreCase to allow the user to put either Yes, YES, or yes. To say not equals, put a ! before the test. My syntax (language rules) in the above hint is not precise and will not compile. You must program it correctly.
You don’t need the else in this test. Our logic only continues if the result is not Yes. If it is Yes, then it doesn’t do the other tests (it exits the if, but you don’t need to say “exit”).
Don’t forget to put System.exit(0) when using JOptionPane.

Categories
Java

Konldd find the attached file. also this is the code https://drive.google.com/fi

konldd find the attached file. Also this is the code
https://drive.google.com/file/d/1o4Mxrs7C-FCoSXhPQ

Categories
Java

There are 17 items and you have 40 minutes to complete the quiz.

This quiz is open-book and -notes. But you may not have enough time to look at the book and notes when you are taking the quiz. Please make sure you have studied all course materials for this unit.
There are 17 items and you have 40 minutes to complete the quiz.

Categories
Java

Answer the following questions, and post your answers:

Module 3 Decision Structures
Mandatory activity:
Download the practice problemsDownload the practice problems and Student FilesDownload Student Files, complete the program.
Zip your practice problem solutions into ONE zip file and submit in the discussion board.
You can see Solutions to Practice Problems provided by the professor after you post your own.
Optional activities:
List at interesting and/or muddy points in this module
Answer the following questions, and post your answers:
1) In programming decision making and looping are based on conditions. How to specify conditions in Java code?
2) In decision making, can all multiple-if-else structures converted into switch structures? why?
3) Why is important to have a break statement in the switch structure?
Post your own questions and/or respond to others’ questions.

Categories
Java

For your first assignment, you will generate a non threaded, sequential program.

Hello,
Please write a program as per given instructions attached in word document
For your first assignment, you will generate a NON THREADED, SEQUENTIAL program. This Sequential program will greet the user with a menu. For now, the menu will have an introduction and a single option. It should look like the following:

Categories
Java

// created: spe 15, 2022

,m the whole description of the problem is attached
this is Material needed:
// *************************************
// Class: CostCalculator
// Author:
// Created: Spe 15, 2022
// Modfied:
//
// Purpose: Calculates costs of truck trips
//
// **********************************************
public class CostCalculator {
public static void main(String args) {
//Parameters for truck 1
int truck1Capacity = 30;
int truck1FuelBurn = 50;
int truck1Cost = 10000;
//using if else and the totalCosts function find and return the best
truck
}
public static int totalCost(int capacity, int fuelBurn, int vehicleCost) {
return vehicleCost + fuelCosts(fuelBurn, numTrips(capacity));
}
public static int fuelCosts(int fuelBurn, int numTrips) {
//calculate fuel costs here
return 0;
}
public static int numTrips(int capacity) {
//calculate number of trips here
return 0;
}
}

Categories
Java

Could we go over this together?

Hello, I need help with Recursion
StringPermutation, StringToDecimal, DecimalToBinary
could we go over this together?

Categories
Java

To solve problems using standard data structure library of a major programming language (e.g. java.util).

Purpose:
To identify and apply basic techniques of algorithm analysis.
To write programs using recursive methods.
To solve problems using standard data structure library of a major programming language (e.g. java.util).