Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java, why does it say the variable revenueHouston cannot be resolved to a variable in the following Java code: public class groceryStore { public

in java, why does it say the variable revenueHouston "cannot be resolved to a variable" in the following Java code:

public class groceryStore {

public static void main(String[] args) {

grocery houstonStore = new grocery ();

grocery seattleStore = new grocery ();

grocery orlandoStore = new grocery ();

houstonStore.applesSoldYearly = 534;

houstonStore.appleRetailPrice = 0.99;

houstonStore.orangesSoldYearly = 429;

houstonStore.orangeRetailPrice = 0.87;

seattleStore.applesSoldYearly = 765;

seattleStore.appleRetailPrice = 0.86;

seattleStore.orangesSoldYearly = 842;

seattleStore.orangeRetailPrice = 0.91;

orlandoStore.applesSoldYearly = 402;

orlandoStore.appleRetailPrice = 0.77;

orlandoStore.orangesSoldYearly = 398;

orlandoStore.orangeRetailPrice = 0.79;

/*System.out.println("The Houston store sold: " + houstonStore.applesSoldYearly + " apples. " + " The apple retail price was:\t $" +

houstonStore.appleRetailPrice + " The Houston store sold:\t" + houstonStore.orangesSoldYearly + " oranges" +

" The orange retail price was :\t $" + houstonStore.orangeRetailPrice );*/

revenueHouston = (houstonStore.applesSoldYearly * houstonStore.appleRetailPrice) + (houstonStore.orangesSoldYearly *

houstonStore.orangeRetailPrice);

}

}

class grocery {

int applesSoldYearly;

double appleRetailPrice;

int orangesSoldYearly;

double orangeRetailPrice;

}

/* double GrossRev(){

double total;

total = applesSoldYearly * appleRetailPrice + orangesSoldYearly * orangeRetailPrice;

System.out.println("The total gross revenue for this particular store is: $" + total);

return total;

}}*/image text in transcribed

2 public class groceryStore 3 public static void main(String] args) ( grocery houston$tore new grocery (); grocery seattleStore new grocery (); grocery orlandoStorenew grocery; houstonStore.applesSoldYearly 534; houstonStore.appleRetailPrice 0.99; houstonStore.orangesSoldYearly429; houstonStore.orangeRetailPrice0.87; seattleStore.applesSoldVearly = 765; seattleStore.appleRetailPrice 0.86; seattleStore.orangesSoldYearly842; seattleStore.orangeRetailPrice 0.91 orlandostore.applesSoldYearly 402; orlandoStore.appleRetailPrice = 0.77; orlandoStore.orangesSoldVearly 398; orlandoStore.orangeRetailPrice- 0.79 System.out-println("The Houston store sold: " + houstonStore.applesSo1dYearly + " apples. " + " The apple retail price was:\t $ 25 6 houstonStore.appleRetailPrice "nThe Houston store sold:\t" + houstonStore.orangesSoldYearlyoranges" " The orange retail price was :\t S" + houstonStore . orangeRetailPrice );"/ revenueHouston = (houstonStore.applesSoldYearly * houstonStore.appleRetailPrice) + (houstonStore . orangesSoldYearly * 1 houstonStore.orangeRetailPrice); 4 8 39 0 class grocery int applesSoldYearly; double appleRetailPrice; int orangesSoldYearly; double orangeRetailPrice; 8 double GrossRev) double total; total applesSoldYearly appleRetailPrice orangesSoldYearly orangeRetailPrice; System.out.println("The total gross revenue for this particular store is:"total); return total; 3)

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

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

Recommended Textbook for

Data Analysis In Microsoft Excel

Authors: Alex Holloway

1st Edition

B0CCCPKTTX, 979-8852388452

More Books

Students also viewed these Databases questions

Question

How will your work impact your free time?

Answered: 1 week ago