• Post Reply Bookmark Topic Watch Topic
  • New Topic

Intro to Java Class help  RSS feed

 
Tony Akers
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my intro to Java class, we are required to to type our code in psudocode first and once it's graded then we will transfer it into Java for a second grading. I wanted to include that to justify why i'm posting in the Java forum.

My question however: I have completed the assignment, however my grades havne't been too great. So I was curious if I could post my assignemnt and my answer, to get some feed back.
Thanks.

Assignemnt:

A.  Design an application for the Homestead Furniture Store that gets sales transation data, including and account number, customer name, and purchase price. Output the account number and name, then output the     customer’s payment each month for the next 12 months. Assume that there is no finance charge, that the customer makes no new purchases, and that the customer pays off the balance with equal monthly payments.
B.  Modify the Homestead Furniture Store application so it executes continuously for any number of customers until a sentinel value is supplied for the account number.

“B” will be the final solution that will be graded.



 
Junilu Lacar
Sheriff
Posts: 11481
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think he was looking for a loop that tells you basically the same thing twelve times. More likely he was looking for one line that says something like "Paid off with 12 monthly payments of X"
 
Junilu Lacar
Sheriff
Posts: 11481
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, the instructions have this: "get sales transaction data" but instead you have two unfocused routines, enterAccountNum and processData. Your input prompts are divided between these two. You also have output mixed in with input. It's better to have input in one routine and output done in another. That makes each routine focused on doing one and only one thing. That's called separation of concerns

Calculating and displaying the monthly payment is also a different concern, BTW.
 
Junilu Lacar
Sheriff
Posts: 11481
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And Welcome to the Ranch!
 
Liutauras Vilda
Sheriff
Posts: 4917
334
BSD
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony Akers wrote:to get some feed back

First source to ask for the feedback supposed to be your instructor, as only him could most accurately provide it, what kind of solution he was expecting from you and what he found actually. Have you asked him?

Another thing that you confusing yourself and reader with variables naming. For instance:
Tony Akers wrote:
So, how balanceDue became purchasePrice?

Tony Akers wrote:
See, you did some typo's in your variables naming here too. Might your lecture is picky on those, so he down marked. If yes, he'd still be right, even though you understand concept, as precision expressing yourself is very important.

 
Liutauras Vilda
Sheriff
Posts: 4917
334
BSD
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If to be nit picky, sorry, but one comment is also misleading:


Of course that way we could get up to ridiculous point, but take important note, if you write a comment, make sure it tells you exactly what it describes, otherwise it is worse than no comment. In general, that comment shouldn't be there and the function name should sound as:
 
Tony Akers
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you "Liutauras Vilda" and "Junilu Lacar" for your replies. I think I see some mistakes I have made. Much appreciated. I will make some changes and post my revisions.
 
Tony Akers
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this look any better? I also realized that the first code I posted didn't account for the second part of the assignemnt, so I fixed that as well.
 
Liutauras Vilda
Sheriff
Posts: 4917
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. I'd say, pay attention to instructions, what variable names it suggests, and what variable names you're using.
2. 'Module' name in the comments is strange one. Revise your class notes if you use such terminology.
3. Junilu already suggested how to separate methods responsibilities. These were probably most important ones as it is stated in your instructions, what kind of functions are needed.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!