Sie sind auf Seite 1von 2

package cellphoneservice;

import java.util.Scanner;
/**
*
* @author Tristan
*/
public class CellPhoneService {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Scanner and variables
Scanner keyboard = new Scanner(System.in);
final int MINUTE_CUTOFF = 500;
final int TEXT_CUTOFF_HIGH = 100;
final int TEXT_CUTOFF_LOW = 0;
final int GIG_CUTOFF_HIGH = 2;
final int GIG_CUTOFF_LOW = 0;
int minutes;
int messages;
int gigabytes;
// Get the amount of minutes, texts, and gigabytes the user wants to
// decide the best plan for them
System.out.println("Please enter the amount of minutes you want”
+ “ for a month.");
minutes = keyboard.nextInt();
System.out.println("Please enter the amount of text messages you”
+ “ want for a month");
messages = keyboard.nextInt();
System.out.println("Please enter the amount of gigabytes you”
+ “ want for a month");
gigabytes = keyboard.nextInt();
// If statements for each plan depending on the user's specifications
System.out.println("- Recommended Phone Service Plans -");
// Plan A
if(minutes < MINUTE_CUTOFF && messages <= TEXT_CUTOFF_LOW &&
gigabytes <= GIG_CUTOFF_LOW)
{
System.out.println("Plan A \nLess than 500 minutes of talk”
+ “\n$49 per month");
}

//Plan B
if(minutes < MINUTE_CUTOFF && messages > TEXT_CUTOFF_LOW &&
gigabytes <= GIG_CUTOFF_LOW)
{
System.out.println("Plan B \nLess than 500 minutes of talk”
+ “\nTexting \n$55 per month");
}

// Plan C
if(minutes >= MINUTE_CUTOFF && messages > TEXT_CUTOFF_LOW &&
messages <= TEXT_CUTOFF_HIGH && gigabytes <=
GIG_CUTOFF_LOW)
{
System.out.println("Plan C \n500+ minutes of talk \nUp to”
+ “ 100 texts \n$61 per month");
}

// Plan D
if(minutes >= MINUTE_CUTOFF && messages >= TEXT_CUTOFF_HIGH &&
gigabytes <= GIG_CUTOFF_LOW)
{
System.out.println("Plan D \n500+ minutes of talk \n100+”
+ “ texts \n$70 per month");
}

// Plan E
if(gigabytes > GIG_CUTOFF_LOW && gigabytes <= GIG_CUTOFF_HIGH)
{
System.out.println("Plan E \n2 or less gigabytes of data”
+ “\n$79 per month");
}

// Plan F
if(gigabytes >= GIG_CUTOFF_HIGH)
{
System.out.println("\nPlan F \n2+ gigabytes of data \n$87”
+ “ per month");
}
}
}

Das könnte Ihnen auch gefallen