Click here to Skip to main content
15,888,069 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I’m new to IT and doing a Java project on nested for loops. I chose hotel booking in Paris. guest needs to choose from 3 options and within those 3 options the guest gets a random room number and then they get a receipt. how do I code it? Help please

What I have tried:

String name, option,option1,option2, option3, roomnum;
    
    name = (JOptionPane.showInputDialog("Write in your full name:"));
    
 //PSEUDOCODE
//Create two arrays, one for sizes and one for guest
//Set-up a for loop for looping through the sizes (outer-loop)
//Make a for loop for looping through guests (inner-loop)
//Place a createLabel() function inside of the inner-loop and set it //so that

 option = (JOptionPane.showInputDialog(name + "\nProceed to choose your preferred room type (eg: option1):\nOption1 = Sunset view with breakfast and dinner services\n" +
"Option2 : Standard room with 2 double beds and 3 full course meals daily \n" +
"Option3 : Sunset + Eiffel Tower view and unlimited dining resrvations"));
 
 if (option = = option1);
 {
 
    
    }
Posted
Updated 15-Sep-20 5:39am
v2
Comments
jeron1 15-Sep-20 11:32am    
You've stated that this is Java related but you've tagged this as C++. Is there a specific question?
Richard MacCutchan 15-Sep-20 11:39am    
I have corrected your tag, this is a Java question, not C++.

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

And what you have showed so far is ... nothing. Read the question again, and pay attention to the pseudocode you have been given - it's pretty explicit!
 
Share this answer
 
Rather than starting with GUI based code, take a look at The Java™ Tutorials[^], and get familiar with the basics of the language.

Also, there is nothing in your question related to nested for loops.
 
Share this answer
 
v3
Comments
OriginalGriff 15-Sep-20 12:00pm    
"... there is nothing in your question related to nested for loops"
They are in the pseudocode.
Richard MacCutchan 15-Sep-20 12:34pm    
D'oh ... again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900