Results 1 to 6 of 6
Thread: school project help
- 03-21-2009, 06:31 PM #1
Member
- Join Date
- Mar 2009
- Posts
- 1
- Rep Power
- 0
school project help
I'm currently taking java in college and was give a project in which i edit the code and make it functional. Ive been messing with this code for hours now and its not making any sense why it wont compile.This is the part of the code that is giving me the problem compiling:
if(inches=10)
{
{
order.setSize(10);
order.setCost(-2);
}
else if (inches=12)
{
order.setSize(12);
order.setCost(0);
}
else if (inches=14)
{
order.setSize(14);
order.setCost(2);
}
else if (inches=16)
{
order.setSize(16);
order.setCost(4);
}
else
{
System.out.println("Sorry that was not one of the choices so a 12 inch pizza will be made.");
order.setSize(12);
order.setCost(0);
}
}
Now i've tryed all different things to get this to work but it just keeps giving me errors such as incompatible types and non matching if else statements. Anyone know whats happening?
-
1 issue: what goes in if condition statements, = or == ?
Also, when posting code here, please use code tags so that your code will retain its formatting and thus will be readable -- after all, your goal is to get as many people to read your post and understand your code as possible, right?
To do this, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.
Another way to do this is to manually place the tags into your code by placing the tag [code] above your pasted code and the tag [/code] below your pasted code like so:
Java Code:[code] // your code goes here // notice how the top and bottom tags are different [/code]
- 03-21-2009, 09:35 PM #3
Senior Member
- Join Date
- Mar 2009
- Location
- USA
- Posts
- 127
- Rep Power
- 0
if(inches==10)
{
order.setSize(10);
order.setCost(-2);
}
else if (inches==12)
{
order.setSize(12);
order.setCost(0);
}
else if (inches==14)
{
order.setSize(14);
order.setCost(2);
}
else if (inches==16)
{
order.setSize(16);
order.setCost(4);
}
else
{
System.out.println("Sorry that was not one of the choices so a 12 inch pizza will be made.");
order.setSize(12);
order.setCost(0);
}
-
And we are all impressed with your ability to do someone else's basic homework problem.
- 03-21-2009, 10:19 PM #5
Please don't post complete solutions
Aseem... it's not a good idea to give complete solutions to the OPs... too much temptation for the OP to do a cut & paste & froget... no learning involved. You can help with code snippets, pseudo code, hints, explanations, links, etc.
CJSLLast edited by CJSLMAN; 03-21-2009 at 10:27 PM. Reason: typo
Chris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 03-22-2009, 09:54 AM #6
Senior Member
- Join Date
- Nov 2007
- Posts
- 160
- Rep Power
- 6
Similar Threads
-
Reord management for a school
By 435.mahesh in forum Advanced JavaReplies: 4Last Post: 03-22-2009, 02:59 PM -
Taking Java In School Need Help
By xEuPhOrIcSx in forum New To JavaReplies: 7Last Post: 02-04-2008, 08:02 AM -
Need help with a program for high school regarding multi-dimensional arrays.
By Torque in forum New To JavaReplies: 2Last Post: 01-07-2008, 07:45 PM -
Beginner Needs Help w/ Program for School
By badness in forum New To JavaReplies: 2Last Post: 11-24-2007, 07:51 PM -
Please help... assignment for school
By confused2000 in forum New To JavaReplies: 3Last Post: 11-12-2007, 08:12 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks