Question
Java Programming II Homework 7 Update Good night Chegg ! I asked this question previously about my Java Programming Homework, check it out here: https://che.gg/2Stzqib
Java Programming II Homework 7 Update
Good night Chegg !
I asked this question previously about my Java Programming Homework, check it out here: https://che.gg/2Stzqib
I'm having a problem with the format that it is presented.
Although all the inputs are perfect, I must format the question properly to receive credit. Think you can assist me? Photos and code included!
NOTICE ABOVE THE COMPARE OUTPUT ERROR
THE ERROR CAN BE FOUND ON LINE 24
THIS IS THE CORRECT FORMATTING CODE:
FarmName: %20s | Number of Animals: %4d | Farm Size: %4d " "Name: %20s | Year of Birth: %4d | Weight: %10.2f | Gender: %c
My professor explained that at the end of every string format statement, a variable should be declared...
Only show failing tests (0 tests hidden) Download this submission 1: Compare output-The output follows the following format: "FarmName: %20s | Number of Animals: %4d i Farm Size: %4d " "Name: %20s l Year of Birth: %40 l weight: %10.2f | Gender: %c " 0/ 16 0:0] Cow, Year Born: 2012, Weight: 1000.5, Gender: F [3:4] Pig, Year Born: 2009, Weight: 550.5, Gender: M Your output [5:9] Donkey, Year Born: 1999, Weight: 773.42, Gender: M 7:1 Sheep, Year Born: 2016, Weight: 164.23, Gender: F [8:5] Goose, Year Born: 2004, Weight: 10.75, Gender: F farm of ten INumber of Animals: 5 Farm Size: FarmName: Name: Name: Name: Name: Name: cow I Year of Birth: 2012 Weight: pig Year of Birth: 2009 Weight: donkey Year of Birth: 1999 I Weight: sheep Year of Birth: 2016 Weight: goose I Year of Birth: 2004 Weight: 1000.50 550.50 773.42 164.23 10.75 Your output does not contain LAB 0 16 ACTIVITY 8.20.1: Homework 3-3 Current file: Driver.java 1 public class Driver 3 public static void main(String] args) 4 Animal a1 new Animal("Cow", 2012, 1000.5, F') Animal a2 new Animal("Pig", 2009, 550.5, 'M' Animal a3new Animal("Donkey", 1999, 773.42, 'M'); Animal a4 new Animal("Sheep", 2016, 164.23, 'F) Animal as new Animal("Goose", 2004, 10.75, 'F') 10 Farm farmville new Farm(1) 12 13 14 15 16 17 18 19 20 21 farmville.addAnimal(e, e, a1) farmville.addAnimal(3, 4, a2); farmville.addAnimal(5, 9, a3) farmville.addAnimal(7, 1, a4) farmville.addAnimal(8, 5, a5); farmville.printDetails) Current file: Animal.java 1 public class Animal 1 private String name; private int birthYear; private double weight; private char gender; 6 8 public Animal (String name, int birthYear, double weight, char gender) this.name name this.birthYearbirthYear this.weight - weight; this.gender -gender 13 15 public String getName) 16 17 18 19 public void setName (String name) f return name; this.name = name 23 public int getBirthYear return birthYear 26 27 public void setBirthYear(int birthYear) this.birthYear-birthYear; 3e 31 public double getweight) ( return weight; 35 public void setweight(double weight) 36 37 38 39 public char getGender) this.weight - weight; return gender; 43 public void setGender(char gender) this.gender gender 46 48 public String toString) return this.getNae)", Year Born:" getBirthYear) + ",Weight:"getweight) Gender: "getenderO; 52 LAB 0/16 ACTIVITY 8.20.1: Homework 3-3 Current file: Farm.java 1 public class Farm 3 private Animal[]] farm; 4 5 public Farm(int size) i farm new Animal[size][size]; = 18 11 public void addAnimal(int row, int col, Animal animal) 12 13 14 15 16 17 18 19 public void printDetails) 20 21 if (row
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started