Charles
Java Coding
Posted in : Java Beginners

October 4, 2008 at 11:53 AM

Hi friend,

Code to solve the problem :

import java.io.*;
class ShippingMethod
{

public static void main(String[] args) throws Exception
{
String shippingMethod = "" ;
double weight=0;
double shippingBase=0;
System.out.println("Enter the UPS,FEDEX or other");

if(shippingMethod.equals("UPS") || shippingMethod.equals("ups"))
{
System.out.println("Enter the Weight");

if(weight<=5)
{
shippingBase = 4.95;
}
else if(weight>5 && weight<=10)
{
shippingBase = 7.95;
}
else if(weight>10)
{
shippingBase = 10.95;
}
}
else if(shippingMethod.equals("FEDEX") || shippingMethod.equals("fedex"))
{
shippingBase = 7.95;

}
else if(shippingMethod.equals("OTHER") || shippingMethod.equals("other"))
{
shippingBase = 9.95;

}

System.out.println("shippingMethod " + shippingMethod);
System.out.println("shippingBase " + shippingBase);

}
}

Thanks

October 4, 2008 at 11:54 AM

Hi friend,

Code to solve the problem :

import java.io.*;
class ShippingMethod
{

public static void main(String[] args) throws Exception
{
String shippingMethod = "" ;
double weight=0;
double shippingBase=0;
System.out.println("Enter the UPS,FEDEX or other");

if(shippingMethod.equals("UPS") || shippingMethod.equals("ups"))
{
System.out.println("Enter the Weight");

if(weight<=5)
{
shippingBase = 4.95;
}
else if(weight>5 && weight<=10)
{
shippingBase = 7.95;
}
else if(weight>10)
{
shippingBase = 10.95;
}
}
else if(shippingMethod.equals("FEDEX") || shippingMethod.equals("fedex"))
{
shippingBase = 7.95;

}
else if(shippingMethod.equals("OTHER") || shippingMethod.equals("other"))
{
shippingBase = 9.95;

}

System.out.println("shippingMethod " + shippingMethod);
System.out.println("shippingBase " + shippingBase);

}
}

Thanks

October 4, 2008 at 12:26 PM

Hi friend,

Code to solve the problem :

import java.io.*;
class ShippingMethod1
{
public static double getUPSShipping() throws IOException
{
System.out.println("Enter the shippingcost");
return shippingcost;
}
public static double getFedExShipping() throws IOException
{
System.out.println("Enter the shippingcost");
return shippingcost;
}
public static double getOtherShipping() throws IOException
{
System.out.println("Enter the shippingcost");
return shippingcost;
}
public static void main(String[] args) throws Exception
{
String shippingMethod = "" ;
double weight=0;
double result=0;
int zip=0;
System.out.println("Enter the UPS,FEDEX or other");
if(shippingMethod.equals("UPS") || shippingMethod.equals("ups"))
{
System.out.println("Enter the weight");
System.out.println("Enter the zip");
result = getUPSShipping();
System.out.println("weight "+ weight);
System.out.println("zip "+ zip);
System.out.println("result "+ result);
}
if(shippingMethod.equals("FEDEX") || shippingMethod.equals("fedex"))
{
System.out.println("Enter the weight");
System.out.println("Enter the zip");
result = getFedExShipping();
System.out.println("weight "+ weight);
System.out.println("zip "+ zip);
System.out.println("result "+ result);
}
if(shippingMethod.equals("Other") || shippingMethod.equals("other"))
{
System.out.println("Enter the weight");
System.out.println("Enter the zip");
result = getOtherShipping();
System.out.println("weight "+ weight);
System.out.println("zip "+ zip);
System.out.println("result "+ result);
}
}
}

Thanks

Java Coding
Java Coding  Hello, Can u please tel me how to improve my coding techniques.I am feeling difficulty with coding but I am perfect with my theory part
coding in java
coding in java  write a code to calculate the product of odd integers from 1-15   class ProductOfOddIntegers { public static void main(String[] args) { long product=1; for(int i=1;i<=15;i
java coding
java coding  Hi sir, WRITE A PROGRAMME TO MAKE EMPLOYMENT MANAGMENT HAVING COLORS AND FRAME IN IT,???? CAN U SUGGEST ME HOW TO MAKE IT IN CORE JAVA
java coding
java coding  sir i need code for how to send meg from one system to another system
java coding
java coding  i am using netbean to my project and it is Desktop Application.i want my textfield to accept only numbers or only alphabets .........plez plez plez do help me..........i am just beginner to java codes
java coding
java coding  i need to to a project in java and the title is file parsing. i need to read a file or if a particular file is given i have to count the no of vowels, pick out some terms, and to display the details about that file
java coding
java coding
java coding  i have source code for my project virtual classroom. i need a little guidance to run that code..do help me out
java coding
java coding  using swing i want to give an exit button which on clicking ask a msg "JOptionPane" is select "yes" then it should exit or else not....plez help me...... JOptionPane.showConfirmDialog(null,"DO YOU REALLY WANT
JAVA coding
JAVA coding  using classes and arrays implement the following create classes, inheritance, object and execute methods. there are 5 students in a class, capture the surname, first name, age and sex. capture their marks of a given
java coding
java coding  plz correct this one ....i want to retrive data row from databse ...all its working but for combobox it not.......plz plz plz help me...... private void jButton4ActionPerformed(java.awt.event.ActionEvent evt
java coding
java coding  can any one plez tell me how to retrive a row from access to each field of swing... i hav tried this but i am getting an SQL error "SQLExceptionOccurred[Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect
java coding
java coding  (person, student,employee, faculty and staff are classes) design a class named person and its two subclasses named student and employee    class Person { public String name; public String address; public
Java coding - WebSevices
Java coding for web services  How to start Java Coding for web services
java coding - Java Beginners
java coding  dear sir, i'm doing a java coding using with netbeans ide, so i'm trying to pass some text from one jframe to another jframe which is both are already opend on screen then how to do it? please send me
Image using Java coding
Image using Java coding  Hai, Display image in pdf file using Java coding through Xsl file.. Please help me.. xsl file generate the pdf file
color coding in java
color coding in java  hii..can anyone please help with auto coloring code in java swings..??a particular text field should have a particular color for a particular event..plzz help
coding - Java Beginners
coding  i need to start coding but i don't know how to start it so plz help me  Hi Friend, Please visit the following link: http://www.roseindia.net/java/ Thanks
single frame coding in java
single frame coding in java  sir, i am a beginner in java.i want to do a desktop application in java in which a single frame satisfies all needs.but i want changes in that frame only.how can i solve this?i think multiple frames
Coding - Java Beginners
Coding  How to do a coding to view employee name, salary and EPF. The EPF is calculated from the salary like 10% from their salary. and it also show... the technologies you create the application in Java/JSP/Servlet/JSF/Struts
coding - Java Beginners
coding  i need start coding but don't have any idea to start plz help me
coding related - Java Beginners
coding related  what is the purpose of using these line in a program? char units = args[1].charAt(0); units = Character.toUpperCase.../java/java-conversion
java coding - Java Beginners
java coding  how to create a window that contain a list of all files of specified directory
coding problem - Java Beginners
coding problem  hi friend! Im new to jasper reports.how can i start that coding inorder to generate reports.can u send some sample programs for reporting?im badly need some clearly mentioned example because im new to jasper
Java Coding - Java Beginners
Java Coding  Code a for loop that adds the integers that are multiples of 5 starting with 50 and ending with 5. Each time the sum is increased, print it on a line at the console. Be sure to declare and initialize any required
j2me coding - Java Magazine
in sms using j2me. i have a problem in coding for sending and receiving sms .i have a coding for receiving sms but it not work because that program need sending... a coding for sending and receiving sms in j2me
Java Coding - Java Beginners
Java Coding  What is the meaning of following statement in Java? Clasname objectname = another_object_name.method_name; The Example Code is Given Below public void sessionCreated(HttpSessionEvent sessionEvent
Java Coding - Java Beginners
Java Coding  How do I code the following: Code a while loop that calculates the sum of the integers that are multiples of 5 starting with 5... on Java visit to : http://www.roseindia.net/java/ Thanks
Java Coding - Java Beginners
Java Coding  Code a private static method named printMessage that accepts a String parameter that represents the message. The method should simply print the message followed by a blank line at the console. Write a statement
Java Coding - Java Beginners
Java Coding  Code nested for loops that calculate the area of a rectangle that can range in size from a length and width of 1 to a length and width of 10. Print the area for each width for a given length on a single line
Java Coding - Java Beginners
Java Coding  Two overloading methods that returns average using following headers A) public static int average(int[] array) B) public static double average(double[] array The program should prompt the user to enter
Tutorials