• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I convert this to a program. thanks.  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I convert this into a program. It's actually for my sixth grade science class but I want to have a program to go along with my model. My dad said I should use JOptionpane but I don't know what that is. thanks for any help. Please don't answer if you aren't going to help thank you.

Environment: In an environment where it snows frequently during the winter, and rains frequently during the spring. Most people are going to work or school during 6:00am to 10:00am, and coming home during 4:00pm to 6:00pm. At noon there is a lunch rush.

Season:
Spring = 3
Summer=1
Fall=1
Winter=5

Time:
6:00am to 10:00am: 5
9:00am to 11:00am: 2
12:00pm: 4
12:00pm to 3:00pm: 1
3:00pm to 6:00pm: 5
6:00pm to 9:00pm: 2
9:00pm to 12:00pm: 2
Make a program that adds up the numbers of both the season and time. If the output is
2, 3, or 4: Print Traffic is Low
5, 6, 7: Print Traffic is Medium
8, 9, 10: Print Traffic High
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JOptionPane can be used to show alert messages. It is not really relevant for your problem. Do you have the logic implemented?
If you do what is the problem and if not what is the problem?
 
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You would have to accept the season and the time as parameters to your 'program'. Based on this input you will then compute the intensity of traffic. This needs to be the processing logic for the program you develop.

Next you would have to take a call on how you intend the application/program to be viewed/accessed. If you want a graphic user interface, JOptionPane would be an option. Another way would be from Command Prompt without using any graphical components.

How you 'execute' this program again would have to be decided. You can write a Batch/Shell script for execution or create an executable (this would not be Platform independent).

 
Addie Mustapha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I wrote all this out, I just don't know how I would make it into java
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then take these steps:

Take some paper and a pencil with a big gum.
Write down the steps you need to perform to get to the desired result (how you do this mentally).
Convert the steps to Java code.

We are willing to help but we're NotACodeMill.
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally speaking, we can't do much with "how do I do this" questions - they are too broad for anyone to really attempt to answer. Some of the immediate things that I would ask you include:

1) Do you have the JDK installed?
2) Do you know how to compile and run a java program?
3) Have you done so for a "hello, world" program?
4) Have you started this project yet? If so, what have you written? Can you post your code here for us to see?
5) What - SPECIFICALLY - do you need help with? The GUI? The logic? The Data model?

Nobody here will write the program for you. If you make an effort, you will be AMAZED at how much help you will get from strangers, but you have to make some effort yourself.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!