Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Tyler Beach
- */
- import java.util.*;
- public class tester {
- public static void main(String[] args) {
- System.out.println("Creating a default apple");
- System.out.println("Printing the default apple's values");
- Apple definition = new Apple();
- System.out.println(definition.toString()+"\n");
- System.out.println("Creating another apple");
- System.out.println("Setting the apple's vaules: \"Granny Smith\" Weight:0.75 Price:0.99");
- Apple a1 = new Apple();
- a1.setType("Granny Smith");
- a1.setWeight(0.75);
- a1.setPrice(0.99);
- System.out.println(a1.toString()+"\n");
- System.out.println("Creating another apple");
- System.out.println("Setting the apple's vaules to the folowing invalid values: \"iPad\" Weight:2.5 Price:-200");
- Apple a2 = new Apple();
- a2.setType("iPad");
- a2.setWeight(2.5);
- a2.setPrice(-200);
- System.out.println(a2.toString()+"\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement