Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the attached Java classes (Car.java and Wheel.java) as a guide, create a representative JSON string that might be produced upon serialization of a Car
Using the attached Java classes (Car.java and Wheel.java) as a guide, create a representative JSON string that might be produced upon serialization of a Car object. You are free to populate the Car and Wheel object properties with any data you like.
------------------------------------------------------------------------------------------------------
package edu.uark.models.api;import org.apache.commons.lang3.StringUtils;public class Car { private String make; public String getMake() { return this.make; } public Car setMake(String make) { this.make = make; return this; } private String model; public String getModel() { return this.model; } public Car setModel(String model) { this.model = model; return this; } private int year; public int getYear() { return this.year; } public Car setYear(int year) { this.year = year; return this; } private double price; public double getPrice() { return this.price; } public Car setPrice(double price) { this.price = price; return this; } private Wheel[] wheels; public Wheel[] getWheels() { return this.wheels; } public Car setWheels(Wheel[] wheels) { this.wheels = wheels; return this; } public Car() { this.year = 0; this.price = 0D; this.wheels = new Wheel[0]; this.make = StringUtils.EMPTY; this.model = StringUtils.EMPTY; }}--------------------------------------------------------------------------------------
package edu.uark.models.api;import org.apache.commons.lang3.StringUtils;public class Wheel { private String make; public String getMake() { return this.make; } public Wheel setMake(String make) { this.make = make; return this; } private String model; public String getModel() { return this.model; } public Wheel setModel(String model) { this.model = model; return this; } private int width; public int getWidth() { return this.width; } public Wheel setWidth(int width) { this.width = width; return this; } private int aspectRatio; public int getAspectRatio() { return this.aspectRatio; } public Wheel setAspectRatio(int aspectRatio) { this.aspectRatio = aspectRatio; return this; } private int diameter; public int getDiameter() { return this.diameter; } public Wheel setDiameter(int diameter) { this.diameter = diameter; return this; } private int loadIndex; public int getLoadIndex() { return this.loadIndex; } public Wheel setLoadIndex(int loadIndex) { this.loadIndex = loadIndex; return this; } public Wheel() { this.width = 0; this.diameter = 0; this.loadIndex = 0; this.aspectRatio = 0; this.make = StringUtils.EMPTY; this.model = StringUtils.EMPTY; }}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