Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

A simple class: Retail Item and Retail Client

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I'm in need of assistance or guidance, I need help on how to complete the processSale() method. This is a two part assignment which I already completed the retail item but I'm in need of of help with the retail client. Thanks.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, what's the question?
 
Anthony Ross
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ben Allen wrote:Sorry, what's the question?



Just need guidance in completing the processSale method at the bottom.

Basically:

//Process the sale of a single RetailItem
// If there are available units of the requested item,
// the stock is depleted by 1
// If there are no units of the requested item available
// the item is re-stocked by adding 5 additional units
//A trace of the transaction is displayed in the console:
// SALE Jacket
// Your Price $59.95 Thank You!
// OR
// SALE Jacket
// Sorry, Temporarily OUT OF STOCK
//
private static void processSale(RetailItem item)
{
String trace = "";
System.out.println(trace);
}


If you could please explain to me this in simpler terms how to go about this. Thanks.
 
Ben Allen
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried breaking the problem into the simplest steps you can? That always helps me. Try to understand the problem as a series of fully described steps, then go about solving them.
 
Anthony Ross
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, but i just can't seem to get this one, should I be throwing a boolean expression to process the sale?
 
To do a great right, do a little wrong - shakepeare. twisted little ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic