initial commit

master
Caroline Hirwing 2 years ago
commit 6db045b3e4
  1. 1
      .gitignore
  2. 35
      Book.java
  3. 10
      CompactDisc.java
  4. 21
      Item.java
  5. 10
      LongPlay.java
  6. 15
      Order.java
  7. 42
      Recording.java
  8. 4
      Vat.java
  9. 8
      Vat25.java
  10. 8
      Vat6.java

1
.gitignore vendored

@ -0,0 +1 @@
*.class

@ -0,0 +1,35 @@
public class Book implements Vat6 extends Item
{
private String author;
private double price;
private boolean bound;
public Book(String name, String author, double price, boolean bound)
{
super(name);
this.author = author;
this.bound = bound;
getPrice(price);
}
public double getPrice(double price)
{
if (bound == false) {
getVat();
price = price + (price * getVat());
}
if (bound == true) {
double vat25 = 0.25;
price = price + (price * vat25);
}
this.price = price;
}
public String toString()
{
return "Book: " + "," + name + "," + author + "," + bound +", "+ price;
}
}

@ -0,0 +1,10 @@
public class CompactDisc extends Recording {
public CompactDisc(String name,String artist,int year,int condition,double price) {
super(name, artist, year, condition, price);
}
public double getPrice() {
setPrice();
}
}

@ -0,0 +1,21 @@
public abstract class Item implements Vat
{
protected String name;
protected double price;
protected Item(String name)
{
this.name = name;
}
public abstract double getPrice(double price);
@Override
public double getVat() {
return getVat();
}
public final double getPricePlusVAT() {
return this.getPrice(price) + this.getPrice(price) * this.getVat();
}
}

@ -0,0 +1,10 @@
public class LongPlay extends Recording {
public LongPlay(String name,String artist,int year,int condition, double price) {
super(name,artist,year,condition,price);
}
public double getPrice() {
setPrice();
}
}

@ -0,0 +1,15 @@
public class Order {
private final long counter;
private final long orderNumber;
List<item> itemLIst;
public double getTotalValue() {
}
public double getTotalValuePlusVAT() {
}
public String printReceipt() {
}
}

@ -0,0 +1,42 @@
public abstract class Recording implements Vat25 extends Item {
protected final int year;
protected final String artist;
protected final double price;
private String type;
protected int condition;
public Recording(String name, String artist, int year, int condition, double price, String type ){
super(name);
this.artist = artist;
this.year = year;
this.condition = condition;
this.type = type;
setPrice(price);
}
private void setPrice(double price){
if(condition >= 1 && condition <=10){
price = (condition / 10) * price;
}
if (condition == 0){
price = 0;
}
if (price > 1 && price <= 10){
price = 10;
}
price = price + (price * getVat());
this.price = price;
}
@Override
public double getVat(){
return 0.25;
}
public String toString(){
return "Recording: " + name + "," + artist + "," + year + "," + condition +"," + type +","+ price;
}
}

@ -0,0 +1,4 @@
public interface Vat
{
public abstract double getVat();
}

@ -0,0 +1,8 @@
public interface Vat25 extends Vat
{
@Override
public default double getVat()
{
return 0.25;
}
}

@ -0,0 +1,8 @@
public interface Vat6 extends Vat
{
@Override
public default double getVat()
{
return 0.06;
}
}
Loading…
Cancel
Save