1. Homepage
  2. Programming
  3. Lab 6: TextImprover, Student, Product and ProductDB, BankAccount and Bank

Lab 6: TextImprover, Student, Product and ProductDB, BankAccount and Bank

Engage in a Conversation
USUCIUniversity of California IrvineTextImprover Student Product and ProductDB BankAccount and BankJava

Lab 6

Nov 7 by 11:59pm CourseNana.COM

INSTRUCTIONS

  1. In an Eclipse project, set up files hierarchy and names following these instructions: CourseNana.COM

  2. Package name: labs.lab6 CourseNana.COM

  3. Add classes: CourseNana.COM

  4. Bank CourseNana.COM

  5. BankAccount CourseNana.COM

  6. Mailbox CourseNana.COM

  7. Message CourseNana.COM

  8. MessagingSystem CourseNana.COM

  9. Product CourseNana.COM

  10. ProductDB CourseNana.COM

  11. Student CourseNana.COM

  12. TextImprover CourseNana.COM

  13. Make sure your methods pass all the examples/test cases suggested. Keep in mind that for grading, we will test other additional values to the ones provided here. CourseNana.COM

  14. For submission: CourseNana.COM

  15. Upload Bank.java, BankAccount.java, Mailbox.java, Message.java, MessagingSystem.java, Product.java, ProductDB.java, Student.java, and TextImprover.java to the Gradescope assignment. Run the sample autograder (which uses the below JUnit test file) as many times as you wish up until the deadline. The test file used for grading will be similar to this one, but will contain different test cases, as well as additional test cases. So be sure to carefully and thoroughly do your own testing of your code as well. CourseNana.COM

  16. Be sure to read the Lab Submission Checklist before submitting your code to Gradescope. CourseNana.COM

JUNIT TEST FILE FOR LAB6: Lab6Test.java (note: all the CourseNana.COM

input files used by the test file are available in Files -> Lab6 -> res) CourseNana.COM

PROBLEM PROMPTS Part A:

Problem 1 and 2: TextImprover (20 pts)

There are some words that people tend to overuse when writing documents, such as "amazing," "literally," "actually," "absolutely," etc. For this problem, you will implement a class that searches for overused words and replaces them with better choices. Implement a class TextImprover that provides a method for improving the text in a text file (let's call it the "input file") by replacing overused words with better choices of words, based on another text file (let's call it "word map") that maps overused words to non-overused words. Use this template: TextImprover.java A few notes: Assume the words in the word map will always be in all lower case and consist of only letters. TextImprover must preserve word case. But you can assume all words in the input file are either in all lower case, leading upper case, or all caps. Assume every word in the input file consists of at least one letter and also include punctuation characters, and there is exactly one space in between each word in a line. TextImprover must preserve the punctuation of the input file. You must catch any FileNotFoundException that is thrown and print out a message in the format: "File: [filename] not found", e.g.,  File: overused1.txt not found Example: // all examples use overused-words.txt as the file containing overused words and their replacements TextImprover ti = new TextImprover("overused-words.txt"); // overused1.txt starts out like this: overused1.txt CourseNana.COM

ti.improveText("overused1.txt"); // overused1.txt now looks like this: overused1-after.txt CourseNana.COM

// overused2.txt starts out like this: overused2.txt CourseNana.COM

ti.improveText("overused2.txt"); // overused2.txt now looks like this: overused2-after.tx CourseNana.COM

Problem 3: Student (10 pts)

Given a Student class (Student.java), modify the class to throw an IllegalArgumentException under the following two conditions: CourseNana.COM

  1. The account is constructed with a negative student ID (exception message: "ID cannot be negative")
  2. An attempt is made to drop a class in which the student is not enrolled (exception message: "Cannot drop class [CLASSNAME] because student is not enrolled in it") Example:

try {   Student george = new Student("George Glass", -1234); CourseNana.COM

} catch (IllegalArgumentException e) { CourseNana.COM

  System.out.println(e.getMessage()); CourseNana.COM

} // The above prints out "ID cannot be negative" CourseNana.COM

Student robert = new Student("Robert Navarro", 1234); CourseNana.COM

robert.addClass("ICS 45J"); CourseNana.COM

robert.addClass("Ballet I"); CourseNana.COM

robert.addClass("Chem 51C"); CourseNana.COM

try {   robert.dropClass("ICS 10"); CourseNana.COM

} catch (IllegalArgumentException e) { CourseNana.COM

  System.out.println(e.getMessage()); CourseNana.COM

} // The above prints out "Cannot drop class ICS 10 because student is not enrolled in it" CourseNana.COM

Problem 4: Product and ProductDB (10 pts)

Robert recently went into business for himself with a pet store! However, he spends so much time sleeping on his couch that he is unaware of modern technology. So in his store, they keep all the data about their products in a text file. Each line in this text file contains the following, separated by semicolons: The name of the product The price of the product The quantity of product Sample file here: products.txt CourseNana.COM

Implement a class Product that is represented by a name, price, and quantity. Use this template: Product.java CourseNana.COM

Also implement a class ProductDB that reads in data from a text file and provides methods for searching and adding products. Use this template: ProductDB.java CourseNana.COM

You must catch any FileNotFoundException that is thrown and print out a message in the format: "File: [filename] not found", e.g.,  File: products1.txt not found Example: CourseNana.COM

ProductDB db = new ProductDB("products.txt db.findProduct("Blue plaid bow tie collar"); // returns the product "Blue plaid bow tie collar" with price 29.95 and quantity 6 CourseNana.COM

db.findProduct("Red bandana"); // returns the product "Red bandana" with price 3.99 and quantity 16 CourseNana.COM

db.findProduct("White porcelain food and water bowl set"); // returns the product "White porcelain food and water bowl set" with price 23.00 and quantity 8 CourseNana.COM

db.findProduct("XL tan fluffy dog bed");  // returns the product "XL tan fluffy dog bed" with price 75.25 and quantity 2 CourseNana.COM

db.findProduct("stuffed sloth"); // returns null CourseNana.COM

db.addProduct("stuffed sloth", 9.99, 4); CourseNana.COM

db.findProduct("stuffed sloth"); // returns the product "stuffed sloth" with price 9.99 and quantity 4 CourseNana.COM

db.addProduct("stuffed sloth", 10.99, 16); CourseNana.COM

db.addProduct("stuffed sloth", 0.99, 1); CourseNana.COM

db.findProduct("stuffed sloth"); // returns the product "stuffed sloth" with price 9.99 and quantity 4 CourseNana.COM

// products.txt now looks like this: products-after.txt CourseNana.COM

Problem 5: BankAccount and Bank (10 pts) Implement a class BankAccount that is represented with an account number and balance. Use this template: BankAccount.java CourseNana.COM

Also implement a class Bank that contains a number of bank accounts, read from a file, and provides a method for returning the account with the lowest balance. Use this template: Bank.java CourseNana.COM

The Bank class must read a file with the format of these sample files: accounts1.dat, accounts2.dat, accounts3.dat, accounts4.dat CourseNana.COM

Namely, the format is: accountNumber1  balance1 accountNumber2  balance2 . . . You can assume that all input files are in the correct format. You must catch any FileNotFoundException that is thrown and print out a message in the format: "File: [filename] not found", e.g.,  File: accounts1.dat not found Example: CourseNana.COM

Bank bank = new Bank(); bank.readFile("accounts1.dat"); bank.getLowestBalanceAccount(); // returns account #2 bank.readFile("accounts2.dat"); bank.getLowestBalanceAccount(); // returns account #4 CourseNana.COM

Part B:

Problems 6-10: Email (50 pts)

Implement a simple e-mail messaging system. A message has a recipient, a sender, and a message text. A mailbox can store messages. Each user has a mailbox. Your program will take four commands: Log in, log out, send, read, and quit. When logging in, the program will ask for just a username. When asking to send a message, the program will ask for the recipient's username and the test of the message. When asking to read messages, the system will display all of the user's messages. The driver / user interface class for the email system, EmailUI, has already been implemented as is given here: EmailUI.java. Your task is to implement the Message, Mailbox, and MessagingSystem classes, using these templates: Message.java, Mailbox.java, MessagingSystem.java. Notice the templates have more details about each class. CourseNana.COM

Example: emailOutput.txt CourseNana.COM

download_frd=1) CourseNana.COM

This tool needs to be loaded in a new browser window The session for this tool has expired. Please reload the page to access the tool again CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
US代写,UCI代写,University of California代写, Irvine代写,TextImprover代写, Student代写, Product and ProductDB代写, BankAccount and Bank代写,Java代写,US代编,UCI代编,University of California代编, Irvine代编,TextImprover代编, Student代编, Product and ProductDB代编, BankAccount and Bank代编,Java代编,US代考,UCI代考,University of California代考, Irvine代考,TextImprover代考, Student代考, Product and ProductDB代考, BankAccount and Bank代考,Java代考,UShelp,UCIhelp,University of Californiahelp, Irvinehelp,TextImproverhelp, Studenthelp, Product and ProductDBhelp, BankAccount and Bankhelp,Javahelp,US作业代写,UCI作业代写,University of California作业代写, Irvine作业代写,TextImprover作业代写, Student作业代写, Product and ProductDB作业代写, BankAccount and Bank作业代写,Java作业代写,US编程代写,UCI编程代写,University of California编程代写, Irvine编程代写,TextImprover编程代写, Student编程代写, Product and ProductDB编程代写, BankAccount and Bank编程代写,Java编程代写,USprogramming help,UCIprogramming help,University of Californiaprogramming help, Irvineprogramming help,TextImproverprogramming help, Studentprogramming help, Product and ProductDBprogramming help, BankAccount and Bankprogramming help,Javaprogramming help,USassignment help,UCIassignment help,University of Californiaassignment help, Irvineassignment help,TextImproverassignment help, Studentassignment help, Product and ProductDBassignment help, BankAccount and Bankassignment help,Javaassignment help,USsolution,UCIsolution,University of Californiasolution, Irvinesolution,TextImproversolution, Studentsolution, Product and ProductDBsolution, BankAccount and Banksolution,Javasolution,