Skip to content
This repository was archived by the owner on Sep 11, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,94 @@
hs_err_pid*
/.metadata/
/.recommenders/




# Created by https://www.gitignore.io/api/java,eclipse

### Eclipse ###

.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

### Eclipse Patch ###
# Eclipse Core
.project

# JDT-specific (Eclipse Java Development Tools)
.classpath

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# End of https://www.gitignore.io/api/java,eclipse

6 changes: 6 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
1 change: 1 addition & 0 deletions AE1/AssEx1.java → AE1/com/dmayers/ae/AssEx1.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package com.dmayers.ae;
/*
* Main method. 1.) Gets customer name and starting balance from JOptionPane
* Create two Model Objects: Wine and Customer Account.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package com.dmayers.ae;
/* Model class to define Customer account. Stores customer name
* current balance, and performs operations to balance to update
* instance var: int current balance, string customerName
Expand Down
34 changes: 15 additions & 19 deletions AE1/LWMGUI.java → AE1/com/dmayers/ae/LWMGUI.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package com.dmayers.ae;
/*
* User Interface, handle events=View/Controller Class
* -Veiw in constructor-controller: actionPerformed
Expand Down Expand Up @@ -150,35 +151,30 @@ private void layoutComponents()
public void actionPerformed(ActionEvent decideWhichAction)
{

String tempAmountText = amountText.getText().trim();
String amountTextString = amountText.getText().trim();
String name = nameText.getText();
Double price = Double.parseDouble(priceText.getText());
int amount = Integer.parseInt(amountText.getText());
String tempPrice = priceText.getText().trim(); //because you were trying to parse here it was throwing the exception
//and stopping your code before it even got to your try catch blocks

Wine wine = new Wine(name,price,amount);
int amount = 0;
double price = 0.0;

//If amount is not an integer, throw error--THIS DOES NOT WORK
//If amount is not an integer, throw error--should work now
try
{
amount = Integer.parseInt(tempAmountText);
amount = Integer.parseInt(amountTextString);
price = Double.parseDouble(tempPrice);

}
catch(NumberFormatException wrongFormat)
{
JOptionPane.showMessageDialog(null, "Incorrect information provided.");
}

//Get price text from string to double
String tempPrice = priceText.getText().trim();
try
{
price = Double.parseDouble(tempPrice);
}
catch(NumberFormatException priceException)
{
JOptionPane.showMessageDialog(null, "Incorrect information provided. Please try again");
System.err.println("Not a double");
JOptionPane.showMessageDialog(null, "Incorrect information provided."); // now we try to parse and if we can't we do something
//if we can then all is good and we can create wine
//(though not sure why you're creating wine...)
}

Wine wine = new Wine(name,price,amount);

//Process Sale
if (decideWhichAction.getSource()==saleButton)
{
Expand Down
1 change: 1 addition & 0 deletions AE1/Wine.java → AE1/com/dmayers/ae/Wine.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package com.dmayers.ae;
/*
* Model Class
* represented info about type of wine involved in transaction
Expand Down