Answered step by step
Verified Expert Solution
Link Copied!

Question

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 to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

(2b-5c-2)3 / (3b4c-6)-2 Simplify. Assume b and c are positive.

Answered: 1 week ago