Any help with this code would be great Im trying to figure o

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;
}
}

Solution

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:-

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; publ
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; publ

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site