Week1Mock1MCQ18

Run Settings
LanguageJava
Language Version
Run Command
public class Main { public static void main(String[] args) { // Harbor, Week 1, Mock 1, PR_PracticeTest_1.pdf // AP CS A // MCQ 18 Tile t1 = new Tile(785, "grey", "ceramic", 6.95); t1.chgMaterial("marble"); System.out.print(t1.toString()); // Output: 785 grey 0.0 0.0 ceramic 0.0 System.out.println(); // MCQ 19 Tile t2 = new Tile(101, "blue"); System.out.print(t2); // Output: 101 blue 0.0 0.0 null 0.0 } }
public class Tile { private int styleNumber; private String color; private double width; private double height; private String material; private double price; Tile(int style, String col) { styleNumber = style; color = col; } Tile(int style, String col, double w, double h, String mat, double price) { styleNumber = style; color = col; width = w; height = h; material = mat; price = price; } Tile(int style, String col, String mat, double price) { styleNumber = style; color = col; material = mat; price = price; } public void chgMaterial(String mat) { String material = mat; } public String toString() { return (styleNumber + " " + color + " " + width + " " + height + " " + material + " " + price); } }
Editor Settings
Theme
Key bindings
Full width
Lines