Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I started with this In Java Programming Language Submit 1 file for this problem. Only do what is required so you do not waste time.

image text in transcribed

I started with this

image text in transcribed

In Java Programming Language

Submit 1 file for this problem. Only do what is required so you do not waste time. Create a class called edu.udc.cs2.Record. The Record class must have 2 private attributes, String name, int yearsEmployed. Assume the value for yearsEmployed will always be at least 1. You will NOT need setters and getters for this exercise, so do not waste time adding them! Create a constructor that will assign these attributes as will be evident in the main example below. You must ONLY create this 1 constructor. Create a main method in the SAME class that contains the following code. This code must NOT be changed in any way unless instructed: Record reckwa = new Record("Kwame", 17); Record recPat = new Record("Pat", 5); Record recNov = new Record("Neuman", 1); //This code MUST output: i/Record: Kwame has been employed for 17 years. I/Record: Pat has been employed for 5 years. I/Record: Neuman has been employed for 1 year. System.out.println("Record:" + reckwa); System.out.println("Record:" + recPat); System.out.println("Record:" + recNov); Clearly, you must add another method to enable this behavior. Note how when the yearsEmployed is 1, the word "year" must output. Make sure you include the period. As a reminder, assume yearsEmployed will always be at least 1. Turn in your Record.java file. Grading will include the following: Code compiles and runs Class in the correct package Only 1 constructor and attributes assigned correctly Two attributes are private and the correct type Output is as specified including spacing and period and year and years correctly done. Code in main appears exactly as it does above. Other directions followed. 1 package edu.udc.cs2; 2 3 public class Record { 4 50 public Record (String string, int i) { 6 7 Record reckwa = new Record ("Kwame", 17); 8 Record recPat = new Record("Pat", 5); 9 Record recNov = new Record("Neuman", 1); 10 } 11 X12 System.out.println("Record:" + reckwa); X13 System.out.println("Record:" + recPat); X14 System.out.println("Record:" + recNov); 15 } 216 }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions

Question

What is the purpose of providing a ledger account for each account?

Answered: 1 week ago

Question

What are the various types of executive compensation?

Answered: 1 week ago

Question

3. Is IBMs program really a mentoring program? Why or why not?

Answered: 1 week ago