• Post Reply Bookmark Topic Watch Topic
  • New Topic

Assignment due in 2 days, no idea what I am doing. Please help!  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have an assignment for my programming class at uni due in 2 days and none of it seems to make sense to me. I've looked over all the class materials and such, and I still don't get half of it.
We are required to make a program for an accountancy company that performs taxation, accounting and auditing services to clients and charges a predetermined hourly and daily rate.
The system has to be menu based and allow for customer details for a job booking to be input, as well as separately display all current jobs that are being performed, all completed jobs, and list scheduled jobs to be completed with different menu options for each. So far I have written some of it, but I can't get the menu to work, and I'm not sure if what I am even doing is correct. I can discern what the code is doing, just not how to write a lot of it myself.

Please help if you can, it would be greatly appreciated as I want to get good marks.
Here is what I have done so far:















 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adam Holmes wrote: So far I have written some of it, but I can't get the menu to work, and I'm not sure if what I am even doing is correct. I can discern what the code is doing, just not how to write a lot of it myself.


You have to TellTheDetails, and quite frankly, if you are "not sure if what [you are] doing is correct", how are we to know ???...

Anyway, what are you seeing? What are you supposed to be seeing? Any speculation on the differences? etc.

Henry
 
Sheriff
Posts: 4289
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch. Thanks for using code blocks!

Obviously, we can't give you the exact answers to homework, but we can steer you in the right way.

What exactly is going wrong with the menu? Be specific.

It looks like you need a loop for the menu. Try coding a loop and post the result back here in a new message (that is, don't modify the original).
 
Adam Holmes
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I should have been more specific, but I'm frustrated and tired at the moment.
The menu works, I can select the different options and they display the titles etc. which all display correctly but when I enter 1 to put in the customer first name, it shows up and then terminates, and when I add a switch statement inside that (which I know is probably wrong) I can input the last name as well but it terminates after that. What I am meant to do is have a submenu "inside" the first menu selection and I'm not sure how to go about that.

I'm also not sure which kind of loop you are suggesting I should use.
Thank you for the quick responses though

EDIT: I should say, less of a submenu, and more of a continuation of inputs.
 
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adam Holmes wrote:So I have an assignment for my programming class at uni due in 2 days and none of it seems to make sense to me. I've looked over all the class materials and such, and I still don't get half of it.

I hate to say, but this sort of request is pretty much doomed to failure, so my advice: Tick this one off as a "FAIL" and either:
(a) Start earlier next time.
or
(b) Ask for help earlier next time.

I also see very little "meat" in your code, which suggests to me that you've left this far too late, because the requirements are NOT simple. We're all volunteers here, and we're all over the globe, so your "response time" will probably reflect who happens to be "up" at the time. And, as has already been said, we'll help you out, but we won't write the code for you.

All that said, my main worry is that last statement of yours: "I've looked over all the class materials and such, and I still don't get half of it".
Why not? Are the course materials bad? Is your prof a bastard? It seems insane to me to be tackling a problem that you don't have the tools to finish without letting someone at your uni know of your problems before there's only 2 days to go (a weekend no less).

If there's something specific you don't understand, we'll be happy to help; but a general "AAGH!!" is beyond even our capabilities.

Winston
 
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The simple approach is to call a method for each of the cases. Then for case 1 in the method you can prompt for input one after the other accordingly.

Similarly for other cases you can loop through a collection of current/complete/scheduled jobs accordingly.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adam Holmes wrote:I can select the different options and they display the titles etc. which all display correctly but when I enter 1 to put in the customer first name, it shows up and then terminates, and when I add a switch statement inside that (which I know is probably wrong) I can input the last name as well but it terminates after that

Notice how on lines 20 -26 you printed a prompt (the menu) and then on line 31 you called scan.nextInt and the program just waited until you typed something ?
nextInt is known as a blocking method. It just sits there waiting until it has something to return and then it returns it.
If you don't have any blocking methods then the code will just keep continuing on to the next line of code until it runs out of lines of code and then it exits.
So, whenever you have a line of code that asks the user for information, you need it to be followed by another line of code that waits for that information to be entered.

Once you have all the information you need, you then have to do something with it.
Once you've done that, you need to ask the user what they want to do next. This is where the loop comes in.
As I said earlier code is executed line by line until you come to the end of the program. If you put some code in a loop then it never reaches the end of the program - it just goes back to the start of the loop.
In your case I think a while loop is the best option. Fot the moment just make it an infinite loop. We can look at how to exit from it later.
So you will end up with something like

See if you can get that working then we can look at the next step.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!