Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Assume that a box of oranges cost 6 dollars and a box of limes cost 9 dollars. Given variables numBoxOranges and numBoxLimes that are read

Assume that a box of oranges cost 6 dollars and a box of limes cost 9 dollars. Given variables numBoxOranges and numBoxLimes that are read from input, compute the total cost and assign totalCost with the result.
Ex: If the input is 516, then the output is: import java.util.Scanner;
public class TotalCost {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
int orangeCost =6;
int limeCost =9;
int numBoxOranges;
int numBoxLimes;
int totalCost;
numBoxOranges = scnr.nextInt();
numBoxLimes = scnr.nextInt();
System.out.println("Cost: "+ totalCost);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions