DEFINITION OF DATA REQUIREMENTS
Produce an itemised consigment note for each customer including
-dimension,weight and price per parcel.
-total weight and price consigment
-number of parcels

RESIDENT DATA
-up to 2kg-£7.50
-up to 4kg-£8.00
-up to 10kg-£8.55
-up to 12kg-£9.10
-up to 14kg-£9.70
-up to 16kg-£10.35
-for each extra 2kg,up to 30kg,add £0.90

USER INTERFACE DESIGN
itemised consigment note produced for each year.This reports contains information required as discussed above in the data requirements section.the customer data destination is shown clearly at the top,followed by details of all parcels and lastly summary information is printed.
CONSIGNMENT:1
CUSTOMER:A

DESTINATION:THE AVENUE,OUTMARKET,BIRMINGHAM
INSTRUCTION:AFTER6 PM

PARCEL LENGTH BREADTH HEIGHT WEIGHT COST
1 0m 0m 0m 2kg £7.50
2 1m 1m 0m 15kg £12.15


public class consignment {

public static void main(String[] args) {
if
up to 2kg-£7.50;
else if
up to 4kg-£8.00;
else if
up to 10kg-£8.55;
else if
up to 12kg-£9.10;
else if
up to 14kg-£9.70;
else if
up to 16kg-£10.35;
else
each extra 2kg,up to 30kg,add £0.90;
}
}

its not working...please assist me because i dont know what to do next...thanks

Recommended Answers

All 9 Replies

It wouldn't work because you did not write it in Java.
If/else should look something like

if(i < 1){
//do something
}
else if(i > 1 && i < 5){
//do something
}
else{
//do something
}

You better find all notes your instructor gave you and start reading as you are seriously behind.

till the same but its till not working.....please help me by running it on your laptop to check if it running......thanks

Till you provide some proper code nobody will pay any attention to your pleads & cry

import javax.swing.JOptionPane;



   public class consignment {

    public static void main(String[] args) {
    int dimension;
    int weight;
    int price per parcel;
    int total weight;
    int  price consigment;
  String  number of parcels;

    numStr=JOptionPane.showInputDialog("enter prices");
    //convert from  String to int
    num = Integer.parseInt(numStr);

       if (num == 2kg)
    //do something
     JOptionPane.showMessageDialog(null,"the price is £7.50");

     else if (num == 4kg)
    //do something
     JOptionPane.showMessageDialog(null,"the price is £8.00");
     else  if (num == 6kg)
    //do something
     JOptionPane.showMessageDialog(null,"the price is £8.55");
     else if (num == 8kg)
    //do something
     JOptionPane.showMessageDialog(null,"the price is £9.10");
     else  if (num == 10kg)
    //do something
     JOptionPane.showMessageDialog(null,"the price is £9.70");
    else if (num == 12kg)
    //do something
     JOptionPane.showMessageDialog(null,"the price is £10.35");

      else ((num == 2kg && num == 30))
    //do something
     JOptionPane.showMessageDialog(null,"the price is £0.90");

     system.exit();
   }

   }

its still giving me errors

Yes it wouldn't work because you ignored brackets that are supposed to be around content that will be executed if condition is true.
Time to start reading Java Tutorials

PS: Your assignment says "up to" meaning example from 0-2kg, 2-4kg so there wouldn't be "=="

import javax.swing.JOptionPane;



    public class consignment {

    public static void main(String[] args) {
    int dimension;
    int weight;
    int price per parcel;
    int total weight;
    int price consigment;
    String number of parcels;

    numStr=JOptionPane.showInputDialog("enter prices");
    //convert from String to int
    num = Integer.parseInt(numStr);

    if (num 0-2kg){
    //do something
    JOptionPane.showMessageDialog(null,"the price is £7.50");
    }
    else if (num 2-4kg){
    //do something
    JOptionPane.showMessageDialog(null,"the price is £8.00");
    }
     else if (num 4-6kg){
    //do something
    JOptionPane.showMessageDialog(null,"the price is £8.55");
     }
     else if (num 6- 8kg){
    //do something
    JOptionPane.showMessageDialog(null,"the price is £9.10");
    }
    else if (num 8-10kg){
    //do something
    JOptionPane.showMessageDialog(null,"the price is £9.70");
    }
     else if (num 10-12kg){
    //do something
    JOptionPane.showMessageDialog(null,"the price is £10.35");
    }
    else (num  2kg-30kg){
    //do something
    JOptionPane.showMessageDialog(null,"the price is £0.90");

    system.exit();
    }

    }

still nt workin..what wrong

1) When you post any code use code tags [code] YOUR CODE HERE [/code]
2) Do not expect to be just spoon-fed, investigating errors and try to understand what is compiler complaining about. It is you who is suppose to learn something, not us.
3) I did not mean that you put inside if/else directly 0-2kg. This is basic programming stuff that you should understand before you attempt to solve it. God damn it, even my neighbour 10 years old son can do better then this...
4) Either find notes from your class or start reading that Java tutorial(already linked in my previous reply on other thread from you)
5) Till you start showing some work on this I do strongly discourage anyone giving you any code

okay have heard you.....i will do it myself..dnt nid ur help animore

you will need to use some other operators the ==.

Google Java operators

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.