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: Internet Service Provider

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Internet Service Provider

    /**
    *
    */
    package version1;

    import javax.swing.JOptionPane;

    /**
    * @author Gardy
    *
    */
    public class InternetApp {

    static double packages;
    static double pack1 = 9.95 ;
    static double pack2 = 13.95;
    static double pack3 = 19.95 ;
    static String input;
    static double hours;
    static double monthlyfee;
    static double regularHours1 = 10;
    static double regularHours2 = 20;
    static double additionalHoursFee;
    static double additionalhours;
    static double total;
    static double total2;
    static double total3;

    public static void main(String[] args) {

    doPackages();

    }


    private static void doPackages() {

    input = JOptionPane.showInputDialog("What is your internet service ID (A, B or C)");

    if(input == null || input.isEmpty()){}


    // Package 1
    if(input.toUpperCase().charAt(0) == 'A');{

    getPackage();}

    //Package 2
    if(input.toUpperCase().charAt(0) == 'B'){

    getPackage2();}

    //Package 3
    if(input.toUpperCase().charAt(0) == 'C');{

    getPackage3();}
    }


    private static void getPackage3() {


    total3 = pack3;

    JOptionPane.showMessageDialog(null, "The total charges are: $" + total3);

    }

    private static void getPackage2() {

    input = JOptionPane.showInputDialog("How many hours have you used");

    hours = Double.parseDouble(input);

    if(hours <= 20){

    total2 = pack2;
    }

    else {

    additionalhours = hours - regularHours2;
    additionalHoursFee = additionalhours * 1.00;
    total2 = pack2 + additionalHoursFee;
    }
    JOptionPane.showMessageDialog(null, "The total charges are: $" + total2);



    }

    private static void getPackage() {

    // input = JOptionPane.showInputDialog("How many hours have you used");
    //
    // hours = Double.parseDouble(input);
    //
    // if(hours <= 10){
    //
    // total = pack1;
    // }
    //
    // else {
    //
    // additionalhours = hours - regularHours1;
    // additionalHoursFee = additionalhours * 2.00;
    // total = pack1 + additionalHoursFee;
    // }
    //
    // JOptionPane.showMessageDialog(null, "The total charges are: $" + total);
    //


    }

    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Internet Service Provider

    Do you have any questions or comments about the code you've posted?

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. JAVA help on file: Internet Service Provider
    By Plural in forum What's Wrong With My Code?
    Replies: 26
    Last Post: March 30th, 2014, 11:03 PM
  2. Replies: 0
    Last Post: March 1st, 2013, 09:34 AM
  3. TimeLag between private internet provider to my EST timezone server
    By bhanuvijay10 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: November 11th, 2012, 05:31 PM
  4. Web Service - Client - WORK OVER INTERNET
    By nikos in forum Java Networking
    Replies: 7
    Last Post: October 19th, 2010, 10:44 AM