QuestionQuestion

Transcribed TextTranscribed Text

Programming Requirements Document Inheritance NARRATIVE DESCRIPTION Read this entire handout before starting. offers three type of degrees: 1. Associate in Art (AA) 2. Associate in Science (AS) 3. Associate in Applied Science (AAS) Each of the three degrees requires students to take basic degree requirements: • a set list of general education (gen ed) hours that must be completed by each student, and • zero or more elective hours which can be taken On top of the base degree requirements, the Associate in Art (AA) degree requires students to take • foreign language class hours • additional class hours in the arts and humanities On top of the base degree requirements, the Associate in Science (AS) degree requires students to take • additional class hours in mathematics and science • a focus area of concentrated studies (such as computer science, cybersecurity, chemistry, etc.) with varying required hours for a given focus area On top of the base degree requirements, the Associate in Applied Science (AAS) degree requires students to take • core class hours in a specific discipline (business, information technology, etc.) • completion of a track of concentrated studies (such as programming or networking for information technology) with varying required hours for a given track This class structure is illustrated in a UML diagram on the next page. A UML diagram provides data types, access modifiers, return types for methods, names of methods, etc. which you are to use when creating the classes. This is a standard model used by many organizations. You should be familiar with UML diagram formats. This is discussed in the Lewis textbook. BCTCdegrees Degree (Abstract Class*) Main (args: String[ ]): void # degree: String # description: String # genEdHours: int # electiveHours: int + getDegree( ) : String + getDescription( ) : String + getGenEdHours( ) : int + getElectiveHours( ) : int + setDescription(String description): void (only required mutator) + toString( ) : String + addGenEdHours(int hours) : void + addElectiveHours(int hours) : void + calcTotalHours( )* : int The UML diagram illustrate the names of the variables and methods the classes should use. This is so that multiple programmers can write code for the classes and they work together. Use the names indicated in the UML diagram. AA AS AAS - foreignLanguageHours : int - AAhours : int - AShours : int - focusArea: String - focusHours: int - AASCoreHours: int - track: String - trackHours: int + getforeignLangHours( ) : int + getAAhours( ) : int + addFLhours(int hours) : void + addAAhours(int hours) : void + toString( ) : String + calcTotalHours( ) : int + getAShours( ) : int + getFocusArea( ) : String + getFocusHours( ) : int + setFocusArea(String focus): void + addAShours(int hours) : void + addFocusHours(int hours) : void + toString( ) : String + calcTotalHours( ) : int + getCoreHours( ) : int + getTrack( ) : String + getTrackHours( ) : int + setTrack(String track) : void + addCoreHours(int hours) : void + addTrackHours(int hours) : void + toString( ) : String + calcTotalHours( ) : int Degree Class: • Degree is an abstract class. • It contains one abstract method entitled calcTotalHours(). Each child class must include and define this method. • This class has a toString() method which will return a nicely formatted string of all data from the class. This method DOES NOT print anything. • One constructor for the degree should have 3 parameters (ordered as degree, gen ed hours, elective hours) o The degree must be AA, AS, or AAS. Invalid values should default to AS. o Description should set based upon the degree: ▪ Associate in Art if degree is AA ▪ Associate in Science if degree is AS ▪ Associate in Applied Science if degree is AAs o Hours should be >= 0 and <= 60. Set to zero for any invalid parameter for hours. • The default constructor (no parameters) should set the data as follows: o Degree is AS o Description is Associate in Science o GenEdHours = 0 o electiveHours = 0 • This class DOES NOT print anything even for errors. All input/output with the user comes thru the driver. AA Class: • This is a child class of Degree. • It has 2 additional data items. • It has accessors and mutators for those items • It has a toString() method which should return a nicely formatted string of all data from the Degree and AA classes. This method DOES NOT print anything. • It must define calcTotalHours(). This is the total of: o gen ed hours from the parent o electives hours from the parent o foreign language hours from the AA class o AA hours from the AA class • One of the constructors for the AA class has 4 parameters (ordered as gen ed hours, elective hours, AA hours, foreign language hours) o Set the degree to AA o Set the degree description to “Associate in Art” o Validate any hours to be >= 0 and <= 60 • The default constructor (no parameters) o Set the degree to AA o Set the degree description to “Associate in Art” o Set all hours to zero • This class DOES NOT print anything even for errors. All input/output with the user comes thru the driver. AS Class: • This is a child class of Degree. • It has 3 additional data items. • It has accessors and mutators for those items • It has a toString() method which should return a nicely formatted string of all data from the Degree and AS classes. This method DOES NOT print anything. • It must define calcTotalHours(). This is the total of: o gen ed hours from the parent o electives hours from the parent o AS hours from the AS class o Focus area hours from the AS class • One of the constructors for the AS class has 5 parameters (ordered as gen ed hours, elective hours, AS hours, focus area, focus area hours): o Set the degree to AS o Set the degree description to “Associate in Science” o Validate any hours to be >= 0 and <= 60 • The default constructor (no parameters) o Set the degree to AS o Set the degree description to “Associate in Science” o Set the focus area to the empty string o Set all hours to zero • This class DOES NOT print anything even for errors. All input/output with the user comes thru the driver. AAS Class: • This is a child class of Degree. • It has 3 additional data items. • It has accessors and mutators for those items • It has a toString() method which should return a nicely formatted string of all data from the Degree and AAS classes. This method DOES NOT print anything. • It must define calcTotalHours(). This is the total of: o gen ed hours from the parent o electives hours from the parent o AAS core hours from the AAS class o Track hours from the AAS class • One of the constructors for the AAS class has 5 parameters (ordered as gen ed hours, elective hours, core hours, track, track hours): o Set the degree to AAS o Set the degree description to “Associate in Applied Science” o Validate any hours to be >= 0 and <= 60 • The default constructor (no parameters) o Set the degree to AAS o Set the degree description to “Associate in Applied Science” o Set the track to the empty string o Set all hours to zero • This class DOES NOT print anything even for errors. All input/output with the user comes thru the driver. CREATE THE CLASSES Create the Degree, AA, AS, and AAS classes. Make sure you use explicit access modifiers (state them) for the class, data, and methods. Add validity checks where appropriate for method parameters. For example, do not allow negative hours, etc. Errorchecking is a given in our work this semester. Remember: Constructors may assign a default value to a class variable if a parameter value is invalid. Mutators DO NOT update class variables if a parameter value provided is invalid. They simply leave the class variable as is. Create a driver which will test your classes. Your professor will create her own test driver to use when she grades your work. This requires you to use the names and data types indicated in the UML diagram. Zip the Degree, AA, AS, AAS and your test driver into ONE zip file and submit for grading. NEW CONCEPTS ASSESSED AND ILLUSTRATED (IN ADDITION TO ANY PREVIOUSLY LEARNED) • Inheritance • Access modifiers for class structures • Abstract classes and methods SOFTWARE REQUIREMENTS (CHECK LIST)  Degree is created correctly. Access modifiers are appropriate for a parent class. Parameters are validated as appropriate for this example. Naming provided in the UML diagram is followed.  AA is created correctly. Access modifiers are appropriate for a child class. Parameters are validated as appropriate for this example. Naming provided in the UML diagram is followed.  AS is created correctly. Access modifiers are appropriate for a child class. Parameters are validated as appropriate for this example. Naming provided in the UML diagram is followed.  AAS is created correctly. Access modifiers are appropriate for a child class. Parameters are validated as appropriate for this example. Naming provided in the UML diagram is followed.  The abstract method is properly implemented in each child class.  The classes are thoroughly documented with boxed comments.  The classes are written and formatted well. White space is used appropriately.  All code is original code developed by the student and does not borrow/use code written by other sources. SECURITY CONSIDERATIONS Access modifiers are used correctly. Parameters are validated before used where appropriate.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

/*
* Program Name: AA
* Author: Cameron.
* Date Written: 2/17/2019.
* Description: This is the AA Degree Class. This program is to provide the
*   variables, constructors, methods, calculations and formatted printed
*   related to the AA class.
*/

package bctcdegrees;

// Beginning of AA Class
public class AA extends Degree
{
    // Declare class variables
    private int foreignLanguageHours;
    private int AAhours;

   
    // Beginning of AA Constructor with parameters
    public AA(int genEdHours,int electiveHours,int AAhours,int foreignLanguageHours)
    {
       // Setting the class variables
       degree = "AA";
       description = "Associate in Art";

       // Validate general ed hours entered is within range or not
       if (genEdHours>=0 && genEdHours<=60)
       {
            // Sets general ed hours to entered general ed hours
            this.genEdHours=genEdHours;
       }
       else
       {
            // Sets general ed hours to 0
            this.genEdHours=0;
       }
               
       // Validate elective hours entered is within range or not
       if (electiveHours>=0 && electiveHours<=60)
       {
            // Sets elective hours to entered elective hours
            this.electiveHours=electiveHours;
       }
       else
       {
            // Sets elective hours to 0
            this.electiveHours=0;
       }
      
       // Validate AA core hours entered is within range or not
       if (AAhours>=0 && AAhours<=60)
       {
            // Sets AAS core hours to entered AA core hours
            this.AAhours=AAhours;
       }
       else
       {
            // Sets AA core hours to 0
            this.AAhours=0;
       }
      
       // Validate foreign language hours entered is within range or not
    if (foreignLanguageHours>=0 && foreignLanguageHours<=60)
       {
            // Sets foreign language hours to entered AAS track hours
            this.foreignLanguageHours=foreignLanguageHours;
       }
       else
       {
            // Sets foreign language hours to 0
          this.foreignLanguageHours=0;
       }
    }   
    // Ending of AA Constructor with parameters
   
    // Beginning of AA Default Constructor
    public AA()
    {
       // Setting variables for the constructor
       degree = "AA";
       description = "Associate in Art";
       genEdHours = 0;
       electiveHours = 0;
       AAhours=0;
       foreignLanguageHours=0;...

By purchasing this solution you'll be able to access the following files:
CodeDocJava.docx.

$20.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats