Question

Programming Project 3 See Dropbox for due date Project Outcomes: Develop a Java program that uses:...

Programming Project 3

See Dropbox for due date

Project Outcomes:

Develop a Java program that uses:

Exception handling

File Processing(text)

Regular Expressions

Prep Readings:

Absolute Java, chapters 1 - 9 and Regular Expression in Java

Project Overview:

Create a Java program that allows a user to pick a cell phone and cell phone package and shows the cost. Inthis program the design is left up to the programmer however good object oriented design is required.   

Project Requirements

Develop a text based menu driven program that calculates cell phone package costs.  You may see Java code for a text based menu at the bottom of this description.

The menu might look something like this:

1. Purchase Cell Plan Package

2. Purchase Cell Phone

3. Purchase Data Plan

4. Search for Transaction by ID

5. Exit

Choosing 1, 2, or 3 should still offer the user the opportunity to buy the other two. For instance, if the user chooses 2 (purchase cell phone) the system will then offer them a cell phone plan and a data plan.

The Cell phone provider has the following monthly talk packages:

1000 minutes, $29.99

5000 minutes, $49.99

unlimited,   $69.99

The provider also sells cells phones:

Model 100, $39.95

Model 200, $49.95

Model 300, $59.95

The following monthly data options are available:

3 GB, $19.99

6 GB, $49.99

Unlimited, $69.99

The following phone shipping cost and information will apply:

zip codes within 325XX - free shipping

Continental United States - 5.00 shipping cost.

zip codes for Alaska (995xx - 999xx) or Hawaii (967xx - 968xx) - 10.00 shipping fee.

Regular Expressions

Zip code input should be ONLY 5 DIGITS.

Phone numbers must be in the form (xxx) xxx-xxxx.

Must Use the Regular Expressions to test the zip code and phone number. Create a User Defined Exception that will require the user to enter the zipcode or phone in correct format before continuing. To learn about Regular Expression in Java try http://www.youtube.com/watch?v=s_PfopWcMwI.  

Customer Information must include: Customer's name, address (street, city, state, zip), phone number,customerID number.

The cell phone company is concerned with the volatile cell phone market so they want the application to be flexible.

The application will read all the talk packages, cell phones and data options from a file. This includes talk package max minutes and cost, cell phone model and cost, and data options and cost. Please name the file“packages.txt” and have the program read it in automatically at startup.

The file format is left up to the developer however; it must be easily readable and maintainable by a non-programmer.

The number of talk packages (3), cell phone models (3) and options (3) are constant.  

Write all completed transaction data to a text file named appropriately. Again file format is up the developer but should be readable. The data should include customerid number, total startup cost and total reoccurring monthly cost.

A menu option to search the Transaction file for a transaction based on customerid number. Assume only one transaction per customer ID.

The remaining design details are left up to the developer, including how to structure the application, how many classes to develop and the interrelationship of those classes. Use the techniques you've learned in this course, including good object oriented design.

Create two UML Class Diagram for this project.

The class diagrams should be created in multiple iterations.

The first series of iterations should be done before you code and should provide a design that the code follows. (Design Version)

The second series of iterations should be completed after the code is complete and should reflex the EXACT class structure of you final program. (Final Version)

The class diagrams should include

Access specifier (- or +).

All instance fields with type.

All methods with return type and parameter types.

Associations, Generalization (Inheritance) and Aggregation and Multiplicity

Stereotyping – Interface or Abstract Classes.

Design Version - completed prior to coding the project to assist with coding.

Final Version - completed after the coding that accurately represents the final version of the code, generally used for maintenance purposes.

No need to include the class with main method in the UML diagrams. Refer to the UML Distilled pdf on the content page as a reference for creating class diagrams

Submission Requirements - Follow the submission requirements posted on elearning. MAKE SURE YOU TURN IN A COPY OF THE TEXT FILE THAT POPULATES THE CELL PHONE PACKAGE, PHONE AND DATA PLAN DATA.

Simple Text-based Menu Code

import java.util.Scanner;

public class SwitchOperatedTextMenu {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

// print menu

for (int i = 1; i <= 5; i++)

System.out.println(i + ". Menu item #" + i);

System.out.println("0. Quit");

// handle user commands

boolean quit = false;

int menuItem;

do {

System.out.print("Choose menu item: ");

menuItem = in.nextInt();

switch (menuItem) {

case 1:

System.out.println("Item #1");

// do something...

break;

case 2:

System.out.println("Item #2");

// do something...

break;

case 3:

System.out.println("Item #3");

// do something...

break;

case 4:

System.out.println("Item #4");

// do something...

break;

case 5:

System.out.println("Item #5");

// do something...

break;

case 0:

quit = true;

break;

default:

System.out.println("Invalid choice.");

}

} while (!quit);

System.out.println("Bye-bye!");

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

/****** This is what I did here *******/

// txt files containing data are here as below

1. menu.txt (containg menu details)

2. cellPhone.txt

3. plan.txt

4. dataPlan.txt

package coreConcepts;

import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

/**

* @author ABC

* I think this is what you looking here we use file reading, Exception Handling

* and oops concepts.

*

*/

public class Exercise {

public static void main(String[] args) throws FileNotFoundException {

SwitchOperatedTextMenu obj = new SwitchOperatedTextMenu();

obj.menu(obj.menuFile);

obj.setOption();

}

}

class SwitchOperatedTextMenu {

String menuFile = "menu.txt";

public void setOption() {

boolean quit = false;

int option;

String cell = "cellPhone.txt", plan = "plan.txt", dataPlan = "dataPlan.txt";

Scanner sc = new Scanner(System.in);

do {

System.out.print("Choose menu item: ");

option = sc.nextInt();

switch (option) {

case 1:

menu(plan);

System.out.println("==========================");

// do something...

break;

case 2:

menu(cell);

System.out.println("==========================");

// do something...

break;

case 3:

menu(dataPlan);

System.out.println("==========================");

// do something...

break;

case 4:

System.out.println("No transaction is available");

System.out.println("==========================");

// do something...

break;

case 0:

quit = true;

break;

default:

System.out.println("Invalid choice.");

System.out.println("==========================");

}

} while (!quit);

}

public void menu(String fileName) {

File file =new File(fileName);

try {

Scanner sc = new Scanner(file);

while (sc.hasNextLine()) {

System.out.println(sc.nextLine());

}

sc.close();

}

catch (FileNotFoundException e) {

e.printStackTrace();

}

}

}

/*********** These classes for extending this into miniProject ************/

//class DataPlans {

// private String data;

// private float cost;

//

// public DataPlans() {

// // TODO Auto-generated constructor stub

// }

// public DataPlans(int data, float cost) {

// this.data = data;

// this.cost = cost;

// }

// @Override

// public String toString() {

// String s = "" + data + " GB, $" + cost;

// return s;

// }

//}

//

//class Plans {

// private String min;

// private float cost;

//

// public Plans() {

// // TODO Auto-generated constructor stub

// }

// public Plans(int min, float cost) {

// this.min = min;

// this.cost = cost;

// }

// @Override

// public String toString() {

// String s = "" + min + " minutes, $" + cost;

// return s;

// }

//}

//

//class CellPhone {

// private String model;

// private float cost;

//

// public CellPhone() {

// // TODO Auto-generated constructor stub

// }

// public CellPhone(String model, float cost) {

// this.model = model;

// this.cost = cost;

// }

// @Override

// public String toString() {

// String s = "Model" + model + ", $" + cost;

// return s;

// }

//}

Add a comment
Know the answer?
Add Answer to:
Programming Project 3 See Dropbox for due date Project Outcomes: Develop a Java program that uses:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Programming Project #5 Project Outcomes: Develop a Java program that Uses selection constructs (if, and if...

    Programming Project #5 Project Outcomes: Develop a Java program that Uses selection constructs (if, and if else). Uses the Java iteration constructs (while, do, for). Uses static variables. Ensure integer variables input are within a range that will not cause integer overflow. Uses proper design techniques including reading UML Class Diagrams Background Information: The Unified Modeling Language (UML) provides a useful notation for designing and developing object-oriented software systems. One of the basic components of the UML is a class...

  • Homework 3: Input Validation 1   Objectives control structures console-based user input using Scanner class writing complete...

    Homework 3: Input Validation 1   Objectives control structures console-based user input using Scanner class writing complete programs using two classes: client and supplier 2   User Interface Specification This is a console-based I/O program. Display should go to System.out (print or println) and the program will get user input using the Scanner class. The flow of execution should be as follows: When the program starts, display a one-line introduction to the user Display a menu with 5 options 1. validate zip...

  • Information About This Project             In the realm of database processing, a flat file is a...

    Information About This Project             In the realm of database processing, a flat file is a text file that holds a table of records.             Here is the data file that is used in this project. The data is converted to comma    separated values ( CSV ) to allow easy reading into an array.                         Table: Consultants ID LName Fee Specialty 101 Roberts 3500 Media 102 Peters 2700 Accounting 103 Paul 1600 Media 104 Michael 2300 Web Design...

  • Regular Expression processor in Java Overview: Create a Java program that will accept a regular expression...

    Regular Expression processor in Java Overview: Create a Java program that will accept a regular expression and a filename for a text file. The program will process the file, looking at every line to find matches for the regular expression and display them. Regular Expression Format The following operators are required to be accepted: + - one or more of the following character (no groups) * - zero or more of the following character (no groups) [] – no negation,...

  • Objective: To implement the programming languages features discussed in class and to develop a program that...

    Objective: To implement the programming languages features discussed in class and to develop a program that uses Graphical User Interfaces (GUI) that provides a friendly environment for users. Project Assignment Design and implement a Hotel Reservation System. The hotel has two types of rooms. One is regular room that has two beds. Another is deluxe room that has two beds and a safe. The regular room price is $120 per night. The deluxe room is $130 per night. A safe...

  • JAVA project PLEASE complete/ create project with comments in the programming explaining everything Text file Year...

    JAVA project PLEASE complete/ create project with comments in the programming explaining everything Text file Year of storm/ Name of storm/ mmdd storm started/ mmdd storm ended/ magnitude of storm/ //made up data 2004/Ali/1212/1219/1 2003/Bob/1123/1222/3 1980/Sarah/0123/0312/0 1956/Michael/1211/1223/4 1988/Ryan/0926/1019/ 1976/Tim/0318/1010/0 2006/Ronald/0919/1012/2 1996/Mona/0707/0723/1 2000/Kim/0101/0201/1 2001/Jim/1101/1201/3 Text file Class storm{ private String nameStorm; private int yearStorm; private int startStorm; private int endStorm; private int magStorm; public storm(String name, int year, int start, int end, int mag){ nameStorm = name; yearStorm = year; startStorm...

  • Hi. This is a prototype of Java. The following Java program was developed for prototyping a...

    Hi. This is a prototype of Java. The following Java program was developed for prototyping a mini calculator. Run the program and provide your feedback as the user/project sponsor. (Save the code as MiniCalculator.java; compile the file: javac MiniCalculator.java; and then run the program: java MiniCalculator). HINTs: May give feedback to the data type and operations handled by the program, the way the program to get numbers and operators, the way the calculation results are output, the termination of the...

  • Java Project In Brief... For this Java project, you will create a Java program for a...

    Java Project In Brief... For this Java project, you will create a Java program for a school. The purpose is to create a report containing one or more classrooms. For each classroom, the report will contain: I need a code that works, runs and the packages are working as well The room number of the classroom. The teacher and the subject assigned to the classroom. A list of students assigned to the classroom including their student id and final grade....

  • Java Programming Part 1 File encryption is the science of writing the contents of a file...

    Java Programming Part 1 File encryption is the science of writing the contents of a file in a secret code. Your encryption program should work like a filter, reading the contents of one file, modifying the data into a code, and then writing the coded contents out to a second file. The second file will be a version of the first file, but written in a secret code. Although there are complex encryption techniques, you should come up with a...

  • CS 2050 – Programming Project # 1 Due Date: Session 3 (that is, in one week!)....

    CS 2050 – Programming Project # 1 Due Date: Session 3 (that is, in one week!). Can be resubmitted up to two times until Session 6 if your first version is submitted by session 3. In this project, you create two classes for tracking students. One class is the Student class that holds student data; the other is the GradeItem class that holds data about grades that students earned in various courses. Note: the next three projects build on this...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT