
In java Using the following code:
import java.util.*;
public class Test { public static void main(String[] args)
{ /* PART 1 - Object and Classes */
System.out.println("Part 1: Object and Classes\n");
// Create scanner object Scanner input = new Scanner(System.in);
// Prompt user to enter new airport name System.out.println("Enter airport name: ");
// Create airport object (with its name ap) using inputted name Airport ap = new Airport(input.nextLine());
// Prompt user to enter first gate's name System.out.println("Enter first gate's name: ");
// Store inputted name as a String variable called n1 String n1 = input.nextLine();
// TODO: Prompt user to enter first gate's length in meters
// TODO: Store inputted length as an int variable called l1
// TODO: Create first gate object (with its name g1) using n1 and l1
// TODO: Prompt user to enter second gate's name
// Store inputted name as a String variable called n2 String n2 = input.next();
// TODO: Prompt user to enter second gate's length in meters
// TODO: Store inputted length as an int variable called l2
// TODO: Create second gate object (with its name g2) using n2 and l2
// TODO: Prints out g1's name
// TODO: Prints out g2's name
// TODO: Prompt user to enter new name for g1
// TODO: Store inputted name as a new String variable named newG1 String newG1 = input.next();
// TODO: Set inputted name as g1's new name
// TODO: Prints out g1's new name
// TODO: Adds the two gate objects into airport
// HINT: Call addGate method with reference to ap
/* PART 2 - Array, For Loops and Math Operation */
System.out.println("\nPart 2: Array, For Loops and Math Operations\n");
// Prompt user to enter a size of array System.out.println("Enter desired size of array: ");
// TODO: Store input as an int variable named size
// TODO: Creates an integer 1D array (named nums) with size
// TODO: Prompt user to enter 5 integers
// TODO: Store 5 inputted integers into the nums array
// HINT: For loop // Make a new integer variable called sum, assign 0 as its value int sum = 0;
// TODO: Calculates the sum by adding all numbers in the nums array
// HINT: For loop // Prints out sum's value System.out.println("The sum of all numbers in array is: " + sum); } }
![Define all of the classes within your FinalsReview
Class #1: Airport.java
Class #2: Gate.java
TestClass: Test.java (Only modify this class)
Airport Class
public class Airport {
private String name:
private int count;
private Gate [] listofGates = new
Gate [10];
}
public Airport () {
name = "N/A";
}
public Airport (String newName) {
name = new Name
}
public String getName() {
return this.name;
}
public void setName(String newName) {
this.name = new Name
}
public void addGate (Gate newGate) {
int size= listofGates.length;
}
if (count == size) {
return;
}
for (int i = 0; i < size; i++)
if (listofGates [i]
listofGates[i]
}
count++;
break;
== null) {
newGateż
=
Gate class:
public class Gate {
private String name;
private int length;
{
{
public Gate () {
}
}
newLength) {
public Gate (String newName, int
}
}
name = "N/A";
length 0;
public String getName() {
return this.name:
}
name = newName;
length
public void setName(String newName)
}
= newLength:
}
public int getLength) {
return this.length;
this.name newName
public void setLength(int newLength)
this length newLength;](https://content.bartleby.com/qna-images/question/4cc12350-3a53-450f-a14a-46602acc95f2/786734dd-6842-4109-a8fd-61dcac1645ef/eeyt4w6_thumbnail.png)


Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 2 images

- import java.util.Scanner; public class leapYearLab { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int userYear; boolean LeapYear; System.out.println("Enter the year"); userYear = scnr.nextInt(); isLeapYear(userYear); //if leap year if (isLeapYear){ System.out.println(userYear + " - leap year"); } else{ System.out.println(userYear + " - not a leap year"); } scnr.close(); } public static boolean isLeapYear(int userYear){ boolean LeapYear; /* Type your code here. */ if ( userYear % 4 == 0) { // checking if year is divisible by 100 if ( userYear % 100 == 0) { // checking if year is divisible by 400 // then it is a leap year if ( userYear % 400 == 0) LeapYear = true; else LeapYear = false; } // if the year is not divisible by 100 else…arrow_forwardimport java.util.Scanner; public class CharMatch { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String userString; char charToFind; int strIndex; userString = scnr.nextLine(); charToFind = scnr.next().charAt(0); strIndex = scnr.nextInt(); /* Your code goes here */ }}arrow_forwardimport java.util.Scanner; public class LabProgram { public static Roster getInput(){ /* Reads course title, creates a roster object with the input title. Note that */ /* the course title might have spaces as in "COP 3804" (i.e. use nextLine) */ /* reads input student information one by one, creates a student object */ /* with each input student and adds the student object to the roster object */ /* the input is formatted as in the sample input and is terminated with a "q" */ /* returns the created roster */ /* Type your code here */ } public static void main(String[] args) { Roster course = getInput(); course.display(); course.dislayScores(); }} public class Student { String id; int score; public Student(String id, int score) { /* Student Employee */ /* Type your code here */ } public String getID() { /* returns student's id */…arrow_forward
- Help me fix the code make it run out like the EXPEarrow_forwardGiven string inputStr on one line and integers idx1 and idx2 on a second line, output "Match found" if the character at index idx1 of inputStr is equal to the character at index idx2. Otherwise, output "Match not found". End with a newline. Ex: If the input is: eerie 4 1 then the output is: Match found Note: Assume the length of string inputStr is greater than or equal to both idx1 and idx2.arrow_forwardimport java.util.Scanner; public class CircleAndSphereWhileLoop{ public static final double MAX_RADIUS = 500.0; public static void main(String[] args) { Scanner in = new Scanner(System.in); // Step 2: Read a double value as radius using prompt // "Enter the radius (between 0.0 and 500.0, exclusive): " // Step 3: While the input radius is not in the ragne (0.0, 500.0) // Display a message on one line (ssuming input value -1) // "The input number -1.00 is out of range." // Read a double value as radius using the same promt double circumference = 2 * Math.PI * radius; double area = Math.PI * radius * radius; double surfaceArea = 4 * Math.PI * Math.pow(radius, 2); double volume = (4 / 3.0) * Math.PI * Math.pow(radius, 3); // Step 4: Display the radius, circle circumference, circle area, // sphere surface area, and…arrow_forward
- StringFun.java import java.util.Scanner; // Needed for the Scanner class 2 3 /** Add a class comment and @tags 4 5 */ 6 7 public class StringFun { /** * @param args not used 8 9 10 11 12 public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please enter your first name: "); 13 14 15 16 17 18 System.out.print("Please enter your last name: "); 19 20 21 //Output the welcome message with name 22 23 24 //Output the length of the name 25 26 27 //Output the username 28 29 30 //Output the initials 31 32 33 //Find and output the first name with switched characters 34 //All Done! } } 35 36 37arrow_forwardimport java.util.Scanner; public class LabProgram { /* Define your method here */ public static void main(String[] args) { Scanner scnr = new Scanner(System.in); /* Type your code here. */ }}arrow_forwardimport java.util.Scanner; public class AutoBidder { public static void main (String [] args) { Scanner scnr = new Scanner (System.in); char keepGoing; int nextBid; nextBid = 0; keepGoing 'y'; * Your solution goes here */ while { nextBid = nextBid + 3; System.out.println ("I'll bid $" + nextBid + "!") ; System.out.print ("Continue bidding? (y/n) "); keepGoing = scnr.next ().charAt (0); } System.out.println (""); }arrow_forward
- 1 import java.util.Scanner; 2 3 public class RedBalloon { public static void main (String 0 args) { Scanner scnr = new Scanner(System.in); boolean isRed; boolean isBalloon; 4 5 6 7 8 isRed = scnr.nextBoolean(); isBalloon = scnr.nextBoolean(); 9 10 11 12 13 } 15 } 14arrow_forwardimport java.util.Scanner;public class main{public static void main(String[] args){Scanner sc = new Scanner(System.in):int year, day, weekday;String month;String outday = "";System.out.printf("Enter the month%n");month = sc.nextLine();System.out.printf("Enter the day%n");month = sc.nextInt();weekay = find_day(month, day);outday = out_weekday(weekday);System.out.printf("The day is: %s%n", outday);}} Change the program from the previous example to take command line arguments instead of using the Scanner. For example, running the program like this:> java OutDays March 14will output the weekday string (which is Thursday) on the console for March 14, 2019). public static void main(String[] args){ int year, day, weekday; String month; String outday = ""; // #### your code here for accessing the command line arguments weekday = find_day(month, day); outday = out_weekday(weekday); System.out.printf("The day is: %s%n", outday);}arrow_forwardimport java.util.Scanner; public class FridayData { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Friday weather = new Friday(); String inputWeather; double inputHumidity; inputWeather = scnr.next(); inputHumidity = scnr.nextDouble(); weather.setWeather(inputWeather); weather.setHumidity(inputHumidity); weather.print(); }}arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





