Immediate Help to fix errors
I received answers to 2 App requests and paid. The JAVA Apps are not working. They are both due at noon tomorrow Eastern time.I need serious and no-BS tutor that can have this working tonight since I have to get them in. I paid 40 to get this far and would pay another $50 to get the work completed and working. I want to see the output from the netbeans IDE directly.
Ticket
import java.util.Date;
public class Ticket {
/** Ticket number */
private long number;
/** Category of Ticket */
private String category;
/**Ticket Holder*/
private String holder;
/** Purchase date */
private Date date;
/** Ticket Price */
private double price;
private boolean status;
/***
*
* @param num
* @param cat
* @param hold
* @param d
* @param p
* @param newstatus
*/
Ticket (String num, String cat,String hold, Date d, double p, boolean newstatus){
number =Long.parseLong(num);
category =cat;
holder =hold;
date =d;
price=p;
status =newstatus;
}
/**
* @return the number
*/
public long getNumber() {
return number;
}
/**
* @return the category
*/
public String getCategory() {
return category;
}
/**
* @return the date
*/
public Date getDate() {
return date;
}
/**
* @param price
* the price to set
*/
public void setPrice(double price) {
this.price = price;
}
/**
* @return the price
*/
public double getPrice() {
return price;
}
/***
*
* @return
*/
public void changePurchaseStatus(boolean newStatus) {
status= newStatus;
}
/***
*
*/
public String toString() {
return "Ticket Number: "+number +"\nCategory: "+category +"\nHolder: "+holder+"\nDate: "+date.toString()+"\nPrice: "+price+"\n";
}
/**
* @return the holder
*/
public String getHolder() {
return holder;
}
}
Merchandise
import java.util.Scanner;
public class Merchandise {
private long id;
private String category;
private String description;
private double price;
private boolean instock;
public Merchandise() {
this.id = 0;
this.category = null;
this.description = null;
this.price = 0;
this.instock=true;
}
public Merchandise(long nid, String nCate, String nDesc, double nPri, boolean instck) {
this.id = nid;
this.category = nCate;
this.description = nDesc;
this.price = nPri;
this.instock=instck;
}
public void setPrice(Double newPrice) {
this.price = newPrice;
}
public void setStock(boolean newStatus) {
this.instock= newStatus;
}
public long getId() {
return id;
}
public String getCategory() {
Scanner in=new Scanner(System.in);
System.out.println("Enter category");
category = in.next();//inputing category
//checking if the item inserted matches the category
String b = new String("T-Shirt");
boolean g = category.equals(b);
if(g==false)
{
String c = new String("Sweatshirt");
boolean h = category.equals(c);
if(h==false)
{
String d = new String("Stuffed Animal");
boolean i = category.equals(d);
if(i==false)
{
System.out.println("Error: Ivalid category! ");
category="UNKNOWN";
}
}
}
in.close();
return category;
}
public String getDescription() {
return description;
}
public double getPrice() {
return price;
}
public String toString() {
return ("NUMBER: "+this.getId()+" CATEGORY: "+ this.getCategory() +
" DESCRIPTION: "+ this.getDescription() +
" PRICE: " + this.getPrice());
}
}
AmusementPark
import java.awt.List;
import java.sql.Date;
import java.util.ArrayList;
//amusementPark class
public class AmusementPark {
//the three instance fields are as follows
private String name;//the name of the bookstore
private ArrayList<Ticket> tickets = new ArrayList<Ticket>();//storing Ticket objects
private ArrayList<Merchandise> merchandise = new ArrayList<Merchandise>();//storing Merchandise objects
public AmusementPark(String name){ this.name = name; }
public String getName(){return name;}//returns the name of the bookstore.
public ArrayList<Date> getTicketDates(){
return tickets;}
//returns an ArrayList<Date> of all the dates for which tickets are still available.
public Date getTicketDates(Date date){
return date;}
public Ticket number getTicket(long number){return Ticket;}
public ArrayList<Merchandise> getMerchandise(){return merchandise;}
public ArrayList<Merchandise> getMerchandise(String category){return merchandise;}
public Merchanidse getMerchandise(long id){return Merchandise;}
}
AmusementParkTester
import java.util.Date;
import java.util.Scanner;
public class AmusementParkTester {
public static void main(String args[]) {
AmusementPark amusementPark = new AmusementPark("Walden Amusement Park");
Ticket adult = new Ticket("123", "Adult", "Air USA", new Date(2015, 3,
12), 12322.4, true);
Ticket child = new Ticket("10", "Children", "Air USA", new Date(2015,
3, 14), 13322.4, true);
Ticket senior = new Ticket("20", "Senior", "Air USA", new Date(2015, 3,
20), 10000.4, true);
Merchandise merchandis1 = new Merchandise("123123", "sweatshirts",
"Nike", 234, true);
Merchandise merchandis2 = new Merchandise("12312323", "t-shirts",
"Nike", 450, true);
// add it to Amuesement oark
amusementPark.addTicket(adult);
amusementPark.addTicket(child);
amusementPark.addTicket(senior);
// Add merchandise
amusementPark.addMerchandise(merchandis1);
amusementPark.addMerchandise(merchandis2);
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.println("1. Show Ticket Details: ");
System.out.println("2. Merchandise Details: ");
System.out.println("3. Remove Merchandise : ");
System.out.println("4. Remove Tickets: ");
System.out.println("Enter the choice: ");
String chString = scanner.nextLine();
switch (Integer.parseInt(chString)) {
case 1:
System.out.print("\nEnter the Ticket ID: ");
int id = Integer.parseInt(scanner.nextLine());
System.out.println(amusementPark.getTicket(id).toString());
break;
case 2:
System.out.print("\nEnter the Category: ");
String cat = scanner.nextLine();
System.out
.println(amusementPark.getMerchandise(cat).toString());
break;
case 3:
System.out.print("\nEnter the ID: ");
String ID = scanner.nextLine();
amusementPark.buyTicket(ID);
break;
case 4:
System.out.print("\nEnter the ID: ");
ID = scanner.nextLine();
amusementPark.buyMerchandise(ID);
break;
}
System.out.println("Do you want to continue(Y/N)?: ");
String choice = scanner.nextLine();
if (choice.charAt(0) == 'N') {
System.exit(0);
}
}
}
}
Retail Transaction Classes
LineItem
import java.util.*;
public class LineItem {
protected String itemName;
protected int quantity;
protected double price;
public LineItem(String itemName, int quantity, double price)
{
this.itemName = itemName;
this.quantity = quantity;
this.price = price;
}
public String getName()
{
return itemName;
}
public int getQuantity()
{
return quantity;
}
public void setQuantity()
{
quantity = quantity;
}
public void setPrice()
{
price = price;
}
public double getPrice()
{
return price;
}
public double getTotalPrice()
{
return quantity*price;
}
public String toString ( ) //Returns a formatted String for output purposes //toString () Method
{
return "\t" + itemName + "\t qty " + quantity + "\t @ $" + price + "\t $" + getTotalPrice();
}
}
Transaction - Not working
import java.util.ArrayList;
public class Transaction {
private final ArrayList<LineItem> lineItems;
private int customerID;
private String customerName;
private String LineItem;
public Transaction(int customerID,String customerName) {
this.customerID = customerID;
this.customerName = customerName;
this.lineItems = new ArrayList<LineItem>();
}
public int getcustomerID(){
return customerID;
}
public void setcustomerID(int customerID){
this.customerID = customerID;
}
public String getcustomerName(){
return customerName;
}
public void setcustomerName(String customerName){
this.customerName = customerName;
}
public String addLineItemString (String itemName, int quantity, double price){
lineItems.add(new LineItem(itemName,quantity,price));
}
double totalPrice = 0;
for (int i =0;i<lineItems.length(); i++){
LineItem item = lineItems.get(i);
totalPrice = totalPrice + item.getTotalPrice();
}
//return "Colgate Toothpaste not found";
public String updateItem(){
return null;
}
public double getTotalPrice(){
return 0;
}
public String getLineItem(){
return LineItem;
}
}
Missing the main routine.
11 years ago
40
- 100 words each question with references
- I need someone to rephrase these four history assignments (about 2.5 pages total)
- Interracial Marriage and Students in Today’s Classroom
- Essay Help 2
- Review the "Enterprise 2.0: The State of a Collaborate Art" Skillsoft® video.
- FP/120 Investing Worksheet
- BUS 415 Week 4 DQ 3
- RES 341 Week 4 Individual Assignment Exercises From the E-Text(5.62, 5.70)
- MAT 116 Week 8 Appendix F Buying a Home
- Question