Results 1 to 2 of 2
  1. #1
    Bentino is offline Member
    Join Date
    Feb 2012
    Posts
    17
    Rep Power
    0

    Default Problem running DataGimmick program!!

    good day all,
    i am having an issue with running my program, i am not sure where i have gone wrong, i would appreciate it if someone could help me asap.

    Thank you

    here is what i was instructed to do:
    You are to write a program for the DataGimmick wireless data provider company. The company
    has three possible plans that consumers can sign up for, as follows:
    Package: Monthly Fee: Included MB: Cost Per Additional (up to) 150 MB:
    A $9.99 150 14.99
    B $24.99 500 12.99
    C $39.99 2000 8.99
    Note that additional data beyond the “Included MB” may only be bought in increments of 150MB,
    even if only a portion as little as 1 additional MB is used.
    Your task is to write a program that:
    • prompts the user for and reads in the exact number of MB of data they used (which cannot
    have a fractional portion).
    • prompts the user to enter the letter corresponding to their plan and reads in that plan’s letter.
    • prints out the total monthly charge (in dollars and cents) for data usage for that user, based
    on what they entered.

    here is my code:
    Java Code:
    import java.util.*;
    
    public class DataGimmick
    {
    
    
    
       public static void main(String [] args)
       {
    	   double cost;
    	   int data;
    	   double fee;
    	   double additional;
    	   Scanner myReader = new Scanner(System.in);
    	   boolean plan;
    	   boolean A;
    	   boolean B;
    	   boolean C;
    	   
    
       //Calculate the cost for different packages.
      
       if (plan = A);
       {   
           data = myReader.nextInt();
    	   fee = (data - 150) / 150;
    	   cost = fee * 9.99;
       }   
        
          
       if ((data - 150) % 150 != 0);   
       {   additional = cost + 14.99;
    	   
       }
    	   
       
       if (plan = B);
       {
           data = myReader.nextInt();
           fee = (data - 500) / 500;
           cost = fee * 24.99;
       }
       
       {
       if ((data - 500) % 500 != 0);   
       {   additional = cost + 12.99;
          
       }   
    	
       
    	
       if (plan = C);
       {
           data = myReader.nextInt();
           fee = (data - 2000) / 2000;
           cost = fee * 39.99;
       }
        
          
       
       if ((data - 2000) % 2000 != 0);   
       {   additional = cost + 8.99;
          
       }   
    	   
    	   
       {
       // Prompt User for the data usage.
       System.out.print("How Much Data Did You Use?");
       data = myReader.nextInt();
    	   
    	// Prompt User for the package plan.
       System.out.print("Which Plan Are You Using?");
       plan = myReader.nextBoolean();
       
       //Print out the total monthly charge for data.
       System.out.printf("Your bill for the month is $%,.2f\n", cost + additional);
       }
     
       
       
       
       
    }

  2. #2
    doWhile is online now Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

    Default Re: Problem running DataGimmick program!!

    am having an issue with running my program, i am not sure where i have gone wrong
    Neither do we...you should give us some context. Does it compile? Are there exceptions? If you want help, you need to describe your problem as best as you can and not hope that we will make the effort to review the problem and code in all its detail, which can be time consuming at best.

Similar Threads

  1. Replies: 7
    Last Post: 12-18-2011, 04:13 AM
  2. Not getting why the program is not running
    By jnjh in forum New To Java
    Replies: 5
    Last Post: 04-07-2011, 10:25 AM
  3. Help with running the program :)
    By dj_ee3 in forum New To Java
    Replies: 2
    Last Post: 02-27-2011, 11:19 PM
  4. Problem with running an external program via java
    By g123456 in forum New To Java
    Replies: 4
    Last Post: 12-30-2009, 05:06 PM
  5. Replies: 0
    Last Post: 08-26-2009, 01:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •