having an issue with an array for flower choice in my project

I am doing this flower shop program and I need to store the orders in some kind of dynamic array, but i’m not allowed to use the following arrays: ArrayList, vector, HashMap, etc I thought that I had sorted it by creating an array called orders but on my IDE its keeps on saying that orders can not be resolved to a variable… here is the code that I have so far I have highlighted the issues with the //

`import java.util.Scanner;
public class MenuTest2B {

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>public final String[] FLOWERS = { "Choose your flower:", "Roses", "Lilys", "Carnations", "Daffodils", "Gerberas", "Chrysanthemums", "Assorted" };
public final double[] FLOWER_PRICES = {0,1.2, 1.3, 1.0, 1.0, 1.1, 1.1, 0.8 };
// create colours + price arrays
public final String[] COLOURS = { "Choose your colour:", "White", "Red", "Pink", "Yellow", "Blue", "Mixed" };
public final double[] COLOUR_PRICES = {0,1.3, 1.2, 1.1, 1.1, 1.2, 1.0 };
// create size + price arrays
public final String[] SIZES = { "Choose your size:", "Small", "Medium", "Large" };
public final double[] SIZE_PRICES = {0,5.5, 7.5, 9.5 };
private Scanner scanner;
public final String[] menu = { "Main Menu", "1. Order a bouquet and get the price.", "2. Display statistics", "3. Exit" };
public void exec() {
scanner = new Scanner( System.in );
int choice;
do
{
displayMenu( menu );
choice = getUserChoice();
switch( choice ) {
case 1:
// use scanner to display menu options for flowers colours and size
orderDetailsAndPriceCalculation();
break;
case 2:
summaryStatistics();
break;
case 3:
System.out.println( "You are exiting the program... Goodbye" );
scanner.close();
break;
default:
System.out.println( "Invalid input. Please select a valid option." );
}
}
while( choice != 3 );
}
public void orderDetailsAndPriceCalculation() {
// adds values for chosen ammounts for orders and puts them into the scanner
System.out.println( "" );
displayMenu( FLOWERS );
int flowerChoice = getUserChoice();
if( flowerChoice == -1 ) {
return;
}
displayMenu( COLOURS );
int colourChoice = getUserChoice();
if( colourChoice == -1 ) {
return;
}
displayMenu( SIZES );
int sizeChoice = getUserChoice();
if( sizeChoice == -1 ) {
return;
}
// calculates the input order details (Flower+Colour)*Size
double totalPrice = ( FLOWER_PRICES[ flowerChoice -1]
+ COLOUR_PRICES[ colourChoice -1] )
* SIZE_PRICES[ sizeChoice -1];
// PRINT TOTAL AMOUNT
System.out.println( "Bouquet Price: £" + totalPrice );
// Stores the new orders details in the 2d orders array
orders[orderCount][0] = flowerChoice; // this is where the issue is
orders[orderCount][1] = colourChoice; // this is where the issue is
orders[orderCount][2] = sizeChoice; // this is where the issue is
orders[orderCount][3] = totalPrice; // this is where the issue is
orderCount++; // this is where the issue is
}
public void summaryStatistics() {
System.out.println( "Summary statistics provided" );
}
private void displayMenu( String obj[] ) {
for( int i = 0; i < obj.length; i ++ ) {
if( i == 0 ) {
System.out.println( obj[ i ] );
}
else {
System.out.println( i + ". " + obj[ i ] );
}
}
}
int getUserChoice() {
try {
return scanner.nextInt();
}
catch( Exception e ) {
return -1;
}
}
public static void main( String[] args ) {
MenuTest2B mt2 = new MenuTest2B();
mt2.exec();
}
</code>
<code>public final String[] FLOWERS = { "Choose your flower:", "Roses", "Lilys", "Carnations", "Daffodils", "Gerberas", "Chrysanthemums", "Assorted" }; public final double[] FLOWER_PRICES = {0,1.2, 1.3, 1.0, 1.0, 1.1, 1.1, 0.8 }; // create colours + price arrays public final String[] COLOURS = { "Choose your colour:", "White", "Red", "Pink", "Yellow", "Blue", "Mixed" }; public final double[] COLOUR_PRICES = {0,1.3, 1.2, 1.1, 1.1, 1.2, 1.0 }; // create size + price arrays public final String[] SIZES = { "Choose your size:", "Small", "Medium", "Large" }; public final double[] SIZE_PRICES = {0,5.5, 7.5, 9.5 }; private Scanner scanner; public final String[] menu = { "Main Menu", "1. Order a bouquet and get the price.", "2. Display statistics", "3. Exit" }; public void exec() { scanner = new Scanner( System.in ); int choice; do { displayMenu( menu ); choice = getUserChoice(); switch( choice ) { case 1: // use scanner to display menu options for flowers colours and size orderDetailsAndPriceCalculation(); break; case 2: summaryStatistics(); break; case 3: System.out.println( "You are exiting the program... Goodbye" ); scanner.close(); break; default: System.out.println( "Invalid input. Please select a valid option." ); } } while( choice != 3 ); } public void orderDetailsAndPriceCalculation() { // adds values for chosen ammounts for orders and puts them into the scanner System.out.println( "" ); displayMenu( FLOWERS ); int flowerChoice = getUserChoice(); if( flowerChoice == -1 ) { return; } displayMenu( COLOURS ); int colourChoice = getUserChoice(); if( colourChoice == -1 ) { return; } displayMenu( SIZES ); int sizeChoice = getUserChoice(); if( sizeChoice == -1 ) { return; } // calculates the input order details (Flower+Colour)*Size double totalPrice = ( FLOWER_PRICES[ flowerChoice -1] + COLOUR_PRICES[ colourChoice -1] ) * SIZE_PRICES[ sizeChoice -1]; // PRINT TOTAL AMOUNT System.out.println( "Bouquet Price: £" + totalPrice ); // Stores the new orders details in the 2d orders array orders[orderCount][0] = flowerChoice; // this is where the issue is orders[orderCount][1] = colourChoice; // this is where the issue is orders[orderCount][2] = sizeChoice; // this is where the issue is orders[orderCount][3] = totalPrice; // this is where the issue is orderCount++; // this is where the issue is } public void summaryStatistics() { System.out.println( "Summary statistics provided" ); } private void displayMenu( String obj[] ) { for( int i = 0; i < obj.length; i ++ ) { if( i == 0 ) { System.out.println( obj[ i ] ); } else { System.out.println( i + ". " + obj[ i ] ); } } } int getUserChoice() { try { return scanner.nextInt(); } catch( Exception e ) { return -1; } } public static void main( String[] args ) { MenuTest2B mt2 = new MenuTest2B(); mt2.exec(); } </code>
public final String[] FLOWERS = { "Choose your flower:", "Roses", "Lilys", "Carnations", "Daffodils", "Gerberas", "Chrysanthemums", "Assorted" };
public final double[] FLOWER_PRICES = {0,1.2, 1.3, 1.0, 1.0, 1.1, 1.1, 0.8 };
// create colours + price arrays
public final String[] COLOURS = { "Choose your colour:", "White", "Red", "Pink", "Yellow", "Blue", "Mixed" };
public final double[] COLOUR_PRICES = {0,1.3, 1.2, 1.1, 1.1, 1.2, 1.0 };
// create size + price arrays
public final String[] SIZES = { "Choose your size:", "Small", "Medium", "Large" };
public final double[] SIZE_PRICES = {0,5.5, 7.5, 9.5 };
private Scanner scanner;  
public final String[] menu = { "Main Menu", "1. Order a bouquet and get the price.", "2. Display statistics", "3. Exit" };

public void exec() {
   scanner = new Scanner( System.in );
   int choice;
   do 
   {
      displayMenu( menu );
      choice = getUserChoice();
      switch( choice ) {
         case 1:
            // use scanner to display menu options for flowers colours and size 
            orderDetailsAndPriceCalculation();
            break;
         case 2:
            summaryStatistics();
            break;
         case 3:
            System.out.println( "You are exiting the program... Goodbye" );
            scanner.close();
            break;
         default:
            System.out.println( "Invalid input. Please select a valid option." );
      }
   }
   while( choice != 3 );

}

public void orderDetailsAndPriceCalculation() {
  

   // adds values for chosen ammounts for orders and puts them into the scanner
   System.out.println( "" );
   displayMenu( FLOWERS );
   int flowerChoice = getUserChoice();
   if( flowerChoice == -1 ) {
      return;
   }
   displayMenu( COLOURS );
   int colourChoice = getUserChoice();
   if( colourChoice == -1 ) {
      return;
   }
   displayMenu( SIZES );
   int sizeChoice = getUserChoice();
   if( sizeChoice == -1 ) {
      return;
   }
   // calculates the input order details (Flower+Colour)*Size 
   double totalPrice = ( FLOWER_PRICES[ flowerChoice -1]
           + COLOUR_PRICES[ colourChoice -1] )
           * SIZE_PRICES[ sizeChoice -1];    
   // PRINT TOTAL AMOUNT

   System.out.println( "Bouquet Price: £" + totalPrice );


       // Stores the new orders details in the 2d orders array
       
       orders[orderCount][0] = flowerChoice; // this is where the issue is
       orders[orderCount][1] = colourChoice; // this is where the issue is
       orders[orderCount][2] = sizeChoice; // this is where the issue is
       orders[orderCount][3] = totalPrice; // this is where the issue is
       orderCount++; // this is where the issue is
}

public void summaryStatistics() {
   System.out.println( "Summary statistics provided" );
}

private void displayMenu( String obj[] ) {
   for( int i = 0; i < obj.length; i ++ ) {
      if( i == 0 ) {
         System.out.println( obj[ i ] );
      }
      else {
         System.out.println( i + ". " + obj[ i ] );
      }
   }
}

int getUserChoice() {
   try {
      return scanner.nextInt();
   }
   catch( Exception e ) {
      return -1;
   }
} 

public static void main( String[] args ) {
   MenuTest2B mt2 = new MenuTest2B();
   mt2.exec(); 
}

}
`

I did try adding a int and a string but that achieved nothing to be honest what I need is for the order choices to be stored somehow so that when menu 2 is selected it will display the statistics I have that part already done and just need to add it to the code once the orders are saved somehow.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật