Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Need help with uni assignment

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Location
    London
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need help with uni assignment

    Hi guys need some input on my coursework

    brief description of what I have to do:

    I need to create a system that quotes a price when a customer specifies what type of box they want.
    they have to specify the following:
    The size of the box (width, length, and height);
    The grade of card;
    Whether they want any colour printing (no colour, or 1, or 2 colour printing);
    Whether they want any bottom and/or corner reinforcement;
    Whether the box has a sealable top;
    The quantity of boxes

    once all this information has been inputed the system should then be able to tell us if the company (flexbox) can supply the box depending if the specifications meet those in the table(ill attach the tables)

    if the company can supply it the system needs to calculate the cost
    if it cant supply it an appropriate message should be posted

    the code has to have a OOD approach(abstraction, inheritance and polymorphism) and create a class hierarchy that describes the types of boxes sold.

    it also needs a gui but the lecturer said get the logic working before implementing a gui

    So far I've only been able to do the class the gets the Width, length and height

    public class FlexboxSize{
     
    	private int Length;
    	private int Width;
    	private int Height;
    	private int Area;
     
    	public FlexboxSize(){	
    		Length = 0;
    		Width = 0;
    		Height = 0;
    	}
     
    	public FlexboxSize(int length, int width, int height){	
    		Length = length;
    		Width = width;
    		Height = height;
    	}	
     
    	public int getLength(){
    		return Length;
    	}
     
    	public void setLength(int length){
    		Length = length;	
    	}
     
    	public int getWidth(){
    		return Width;
    	}
     
    	public void setWidth(int width){
    		Width = width;	
    	}
     
    	public int getHeigth(){
    		return Height;
    	}
     
    	public void setHeight(int height){
    		Height = height;	
    	}
     
    	public int areaOfBox(){		
    		return Area =  Width * Height * Length;
    	}
     
    	public String toString(){
    		return "Length = " + Length + " Width = " + Width + " Height = " + Height;
    	}
     
    }

    I have created other class's but keep getting the feeling the way im going about it is wrong

    can someone advise me on how to go about this
    what steps to take next

    Ive tried a couple approaches but they all don't seem to be right
    Attached Images Attached Images


  2. #2
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,659
    Thanks
    25
    Thanked 325 Times in 302 Posts

    Default Re: Need help with uni assignment

    Apart from proper java convention (ie: not giving the instance variables names which start with a capital letter), it seems mostly fine.
    One thing I would do is get rid of your "Area" variable, and just make the areaOfBox() method return the Width*Height*Length without setting a variable. The "Area" variable is a waste of memory if you aren't using it.

    As for your "next steps", it depends on what other classes and stuff you've already done.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

Similar Threads

  1. Desperately need help for Uni Assignment. Willing to pay.
    By DJDidymo in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 2nd, 2013, 12:15 AM
  2. Replies: 0
    Last Post: February 8th, 2013, 01:36 PM
  3. Hi guys..I need some tips in creating a library programme for my Uni project
    By clarky2006 in forum What's Wrong With My Code?
    Replies: 13
    Last Post: November 21st, 2012, 01:42 PM
  4. Boucing ball from stanford uni
    By NoviceJAVA in forum AWT / Java Swing
    Replies: 0
    Last Post: October 8th, 2011, 05:38 PM
  5. Uni project - help please :)
    By sameer in forum Java Theory & Questions
    Replies: 0
    Last Post: November 6th, 2010, 10:54 AM