Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. /*
  2.  * Tyler Beach
  3.  */
  4. import java.util.*;
  5. public class tester {
  6.  
  7.     public static void main(String[] args) {
  8.         System.out.println("Creating a default apple");
  9.         System.out.println("Printing the default apple's values");
  10.         Apple definition = new Apple();
  11.         System.out.println(definition.toString()+"\n");
  12.        
  13.         System.out.println("Creating another apple");
  14.         System.out.println("Setting the apple's vaules: \"Granny Smith\" Weight:0.75 Price:0.99");
  15.         Apple a1 = new Apple();
  16.         a1.setType("Granny Smith");
  17.         a1.setWeight(0.75);
  18.         a1.setPrice(0.99);
  19.         System.out.println(a1.toString()+"\n");
  20.        
  21.         System.out.println("Creating another apple");
  22.         System.out.println("Setting the apple's vaules to the folowing invalid values: \"iPad\" Weight:2.5 Price:-200");
  23.         Apple a2 = new Apple();
  24.         a2.setType("iPad");
  25.         a2.setWeight(2.5);
  26.         a2.setPrice(-200);
  27.         System.out.println(a2.toString()+"\n");
  28.        
  29.  
  30.  
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement