• Post Reply Bookmark Topic Watch Topic
  • New Topic

Complete the body of the setPrice method.  RSS feed

 
Grahamm Tulliss
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help with this! thanks!

Complete the body of the setPrice method so that it assigns the
value of its parameter to the price field.

public void setPrice(int ticketCost)
{
Price=ticketCost;
}
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is your question related to this?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess so.
Comparing to the other thread, Java variables are case sensitive, so if the variable is called 'price', then you can't refer to as 'Price'
 
Campbell Ritchie
Marshal
Posts: 56578
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch

You haven't provided full details, but if we make some reasonable assumptions about the rest of the class, there is only one error: the capital P in Price. Are you sure ticketCost is the best name for the parameter?

Please use the code button and use the correct indentation.
[ September 14, 2008: Message edited by: Campbell Ritchie ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!