Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the PilotLicense class, declare the following private fields: integer year integer fee integer id and define the following public methods: getYear() has no

 

In the PilotLicense class, declare the following private fields: integer year integer fee integer id and define the following public methods: getYear() has no parameters and returns the year field. getFee() has no parameters and returns the fee field. getid) has no parameters and returns the id field. Ex: If the input is 2016 6 683, then the output is: License year: 2016 License fee: 6 License id: 683 Note: If a field is not properly declared as private, an error message will be output. PilotLicense.java PilotLicenselnfo.java public class PilotLicense { /*Your code goes here */ public void setYear(int newYear) { year = newYear; } public void setFee(int newFee) { fee = newFee; } public void setld(int newld) { id = newld; } } import java.util.Scanner; public class PilotLicenselnfo { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); PilotLicense pilot1 = new PilotLicense(); int input Year; int inputFee; int inputld; input Year = scnr.nextInt(); inputFee = scnr.nextInt(); inputld = scnr.nextInt(); pilot1.set Year(input Year); pilot1.setFee(inputFee); pilot1.setId(inputld); System.out.println("License year: " + pilot1.getYear(); System.out.println("License fee: " + pilot1.getFee()); System.out.println("License id: " + pilot1.getld(); In the PilotLicense class, declare the following private fields: integer year integer fee integer id and define the following public methods: getYear() has no parameters and returns the year field. getFee() has no parameters and returns the fee field. getid) has no parameters and returns the id field. Ex: If the input is 2016 6 683, then the output is: License year: 2016 License fee: 6 License id: 683 Note: If a field is not properly declared as private, an error message will be output. PilotLicense.java PilotLicenselnfo.java public class PilotLicense { /*Your code goes here */ public void setYear(int newYear) { year = newYear; } public void setFee(int newFee) { fee = newFee; } public void setld(int newld) { id= newld; } } import java.util.Scanner; public class PilotLicenselnfo { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); PilotLicense pilot1 = new PilotLicense(); int input Year; int inputFee; int inputld; input Year = scnr.nextInt(); inputFee = scnr.nextInt(); inputld = scnr.nextInt(); pilot1.set Year(input Year); pilot1.setFee(inputFee); pilot1.setId(inputld); System.out.println("License year: " + pilot1.getYear(); System.out.println("License fee: " + pilot1.getFee()); System.out.println("License id: " + pilot1.getld();

Step by Step Solution

3.53 Rating (153 Votes )

There are 3 Steps involved in it

Step: 1

public class Main public static void mainString args int ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java Programming

Authors: Joyce Farrell

9th edition

1337397075, 978-1337397070

More Books

Students also viewed these Programming questions