Help with school project (netbeans)

Jul 10, 2018
2
0
10
So i'm being forced to take a class of programming in school idk why but I am. Thing is that even if I don't like it I still know how to do everything we've seen and have been getting good grades until now that we got a project coming up and I've tried with what we've seen in classes but I don't feel it's enough and I've asked the teacher and he says that with what we've seen it's enough so after googling programming forums I found this one and hope i'm putting this in the right place (I apologize if i'm not).

So pretty much what I need to do is a Gas station where it asks for the person's name and then they have to select what type of gas they want (3 types their name don't matter) once they do that the program will ask them how many litters do they want to buy and with whatever each of the 3 types of gas cost it'll tell the total amount that it'll cost to buy that much gas. After that happens they would be asked if they want to go over the process again and if they click yes it'll ask what type of gas again and everything goes again and once they hit no in if they want to do it again it'll say a message of the total price of the gas like of all of the liters in total that the user entered and the price. All of this needs to be done through JOptionPanes comboboxes or message boxes.

I do know how to do some of it but there's other things I don't know how to do and because I don't I can't really do that ones I know. So this is why I hope I can get some help! Thanks! Sorry for my english i'm not from the US.
 
Solution
The point of the flowchart is to break down the process being programmed into steps that can be matched by code.

A really good flowchart is independent of the programming language.

Flowcharts are pictures. Code is syntax.

Programmers can and do take a flowchart and convert it into code.

If you wish to draw a square a flowchart might read:

Start
Go 100 pixels
Turn right
Go 100 pixels
Turn right
Go 100 pixels
Turn right
Go 100 pixels
Stop

Or you could use a loop containing "Go 100 pixels, Turn right" four times.

Per your post, the first thing that the customer must do is enter their name.

Example:

Start

Prompt customer to enter name

Did customer enter name? Yes No.

If Yes go to next step

If No go to Prompt customer to enter...
The key is for you to understand the flow of events.

One tool for doing so is a flow chart. Easily googled for "how-to" and further explanations.

A flow chart establishes what needs to be done and in what order. Step-by-step and logical.

Basically a picture of things that needto be done: an input, a process, an output.

The flowchart also presents logic. What happens if a customer choses type 3 gas or inputs a type of gas that does not exist.

Process example: Person inputs that they wish to purchase 10 liters of gas and the cost per liter is $2.80 US.

So your code will need some function that multiplies liters * cost per liter = total amount.

Figure out the expected/required flow of events.

Then you do the necessary coding for each step in the flow chart.

Here is a link to help you get started:

https://creately.com/blog/diagrams/flowchart-guide-flowchart-tutorial/

You can download software to help with creating the flowcharts but my recommendation is to start with just pencil and paper.

Your flowcharts do not need to be a work of art or anything fancy. And do expect to make continual revisions at first as you learn both flowcharting and how to use flowcharting to represent the logic necessary for coding.
 
Jul 10, 2018
2
0
10

Thanks for the reply. What's the point of the flow chart if I don't know how to program it though? I do know the process and how everything needs to go in order I just don't know how to make it. I don't know if you understand me. Also the customer is supposed to choose from 3 gas types that I should provide. So like they don't type it they select it from a combobox or something like that.
 
The point of the flowchart is to break down the process being programmed into steps that can be matched by code.

A really good flowchart is independent of the programming language.

Flowcharts are pictures. Code is syntax.

Programmers can and do take a flowchart and convert it into code.

If you wish to draw a square a flowchart might read:

Start
Go 100 pixels
Turn right
Go 100 pixels
Turn right
Go 100 pixels
Turn right
Go 100 pixels
Stop

Or you could use a loop containing "Go 100 pixels, Turn right" four times.

Per your post, the first thing that the customer must do is enter their name.

Example:

Start

Prompt customer to enter name

Did customer enter name? Yes No.

If Yes go to next step

If No go to Prompt customer to enter name.

……

Forum rules prohibit doing homework for people so I really cannot go much farther.

Focus on and work at creating some code for each necessary action and process. Then put the pieces together.

Your code does not have to be perfect the first time. Get it to work and then look for ways to simplify and clean it up.

Use lots of comments that explain what each section of code is doing.

Read some of the links, sketch it out, and start coding piece by piece.




 
Solution