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

Any help with this code would be great. Im trying to figure out the calculations

ID: 3781574 • Letter: A

Question

Any help with this code would be great. Im trying to figure out the calculations. Thanks

public static void main(String[] args) {
import java.util.Scanner;

public class Fruit Inventory
{

public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int numApples = 0;
int numOranges = 0;
int InStock = 0;
int totalOranges = 0;
int totalApples = 0;

final orangesNeeded, applesNeeded = 50;
minimum numApples;
final minimum numOranges = 25;

System.out.println(“How many apples on hand?”);
numApples = scnr.next();

// Obtain number of oranges
System.out.println("How many oranges on hand?");
numOranges= scnr.next();

// Calculate how many apples in stock
totalApples = numApples + inStock;
System.out.println("totalApples: “ numApples + " inStock");

// Calculate how many oranges in stock
totalOranges = numOranges / inStock;
System.out.println("totalOranges: " + numOranges + " inStock");

// Calculate how many of each should be ordered
orangesNeeded =
applesNeeded=


return;
}
}

Explanation / Answer

fruitInventory.java

import java.util.Scanner;
public class fruitInventory
{
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int numApples = 0;
int numOranges = 0;
int inStock = 0;
int totalOranges = 0;
int totalApples = 0;

int orangesNeeded, applesNeeded = 50;
int minimumnumApples = 0;
int minimumnumOranges = 25;

System.out.println("How many apples on hand?");
numApples = scnr.nextInt();

// Obtain number of oranges
System.out.println("How many oranges on hand?");
numOranges= scnr.nextInt();

// Calculate how many apples in stock
totalApples = numApples + inStock;
System.out.println("totalApples: "+ totalApples);

// Calculate how many oranges in stock
totalOranges = numOranges+inStock;
System.out.println("totalOranges: " + totalOranges);

// Calculate how many of each should be ordered
orangesNeeded = totalOranges - minimumnumOranges;
applesNeeded= totalApples - minimumnumApples;

System.out.println("orangesNeeded: "+orangesNeeded);
System.out.println("applesNeeded: "+applesNeeded);

return;
}
}

Output:-

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