Question

Java is an object-oriented programming language that enables us to define classes and to instantiate them...

Java is an object-oriented programming language that enables us to define classes and to instantiate them into objects. These objects then call each other’s methods to implement the behavior of the application. The Unified Modeling Language (UML) is an object-oriented visual notation to document the design of object-oriented classes.

For this discussion, you will practice designing a Java class called Course, drawing a UML class diagram for the Course class, and then implementing the Course class in Java code. Review the Resources section to help you with this discussion.

Design a Java class called Course that has the following attributes:

  1. code – a string field to store the course code (for example, IT1006).
  2. creditHours – an int field to store the credit hours of the course (for example, 6).

Using one of the UML drawing tools available in the Resources, draw a UML class diagram for the Course class. Then implement your design of the Course class in Java.

You will be expected to provide a screenshot of the result of your work.

PLEASE COMMENT THROUGHOUT CODE AND EXPLAIN WHY YOU USED WHAT YOU USED. ALSO EXPLAIN HOW YOU DREW THE UML

0 0
Add a comment Improve this question Transcribed image text
Answer #1

There is a total of three images which contain an explanation.

This is the code which will create the class Course and the attributes.

// Save the file by name Main.java
// Defining class Course having two attributes
class Course
{
String code; // code attribute, which will store code
int creditHours; // creditHours, which will store credit hours
}

class Main // Main class
{
public static void main(String args[])
{
Course myCource = new Course(); // Creating a new object of class Course
myCource.code = "IT1006"; // Assigning value to code
myCource.creditHours = 6; // Assigning value to credit hours

System.out.println("Code : " + myCource.code ); // printing the code
System.out.println("Credit Hours : " + myCource.creditHours ); // printing the credit hours

}
}

Add a comment
Know the answer?
Add Answer to:
Java is an object-oriented programming language that enables us to define classes and to instantiate them...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In c# So far, you have created object-oriented code for individual classes. You have built objects...

    In c# So far, you have created object-oriented code for individual classes. You have built objects from these classes. Last week, you created a UML for new inherited classes and objects. Finally, you have used polymorphism. When you add abstraction to this mix, you have the “4 Pillars of OOP.” Now, you begin putting the pieces together to create larger object-oriented programs. Objectives for the project are: Create OO classes that contain inherited and polymorphic members Create abstracted classes and...

  • Java - Object Oriented Programming From the game slither.io Identify objects that you can see ...

    Java - Object Oriented Programming From the game slither.io Identify objects that you can see on the picture. Pick one object from part a. Create a class (Java code) for that object which contain data member, method and constructor. Implement the class inside main function by creating that object.

  • Java In object-oriented programming, we speak of classes, instances, methods, and messages. Briefly define and give...

    Java In object-oriented programming, we speak of classes, instances, methods, and messages. Briefly define and give an example of each on a code segment. HTML Editora BIVA-A - IEI X X 5 = EDO NV 12pt - Paragrap

  • Use Java please... Activity 1. Suppose we want to have an object-oriented design for an invoicing...

    Use Java please... Activity 1. Suppose we want to have an object-oriented design for an invoicing system, that includes invoices, one or more line items in each invoice, address of the invoice, list of products, etc. Try to design this system by indicating the required classes, responsibilities of each class, and the collaborating classes to fulfill each responsibility, and draw the CRC cards as well as UML diagram of the classes and their relationships. Then, indicate the methods of each...

  • first we are requested to transfer the code to any OO programming language (Java, C#, C++...

    first we are requested to transfer the code to any OO programming language (Java, C#, C++ or VB) using the syntax of the selected language with the necessary modifications then we do the use case, domain model,class diagram, sequence diagram, - Develop (Analyze and Design) a GPA calculator using the same UML approach where the student enters his/her courses as objects with attributes: course Id, course credit hours and course grade. The system will calculate the Cumulative GPA for all...

  • Computer Science 111 Introduction to Algorithms and Programming: Java Programming Net Beans Project #4 - Classes...

    Computer Science 111 Introduction to Algorithms and Programming: Java Programming Net Beans Project #4 - Classes and Objects (15 Points) You will create 3 new classes for this project, two will be chosen (THE TWO CHOSEN ARE TENNIS SHOE AND TREE) from the list below and one will be an entirely new class you invent. Here is the list: Cellphone Clothes JuiceDrink Book MusicBand Bike GameConsole Tree Automobile Baseball MusicPlayer Laptop TennisShoe Cartoon EnergyDrink TabletComputer RealityShow HalloweenCostume Design First Create...

  • Programming Assignment 6: Object Oriented Programming Due date: Check Syllabus and Canvas Objectives: After successfully completing...

    Programming Assignment 6: Object Oriented Programming Due date: Check Syllabus and Canvas Objectives: After successfully completing this assignment, students will practice Object Oriented design and programming by creating a Java program that will implement Object Oriented basic concepts. RetailItem Class: Part 1: Write a class named RetailItem that holds data about an item in a retail store. The class should have the following fields: • description. The description field references a String object that holds a brief description of the...

  • [Continued] Your Course class should have: 1)a getter for the course 'code', so that it is...

    [Continued] Your Course class should have: 1)a getter for the course 'code', so that it is read-only; 2)a getter and setter for the lecturer attribute, so that it is readable and writable; 3)a constructor that creates the associations shown in the UML diagram; 4)an enrolStudent method that adds a given Student object into the 'enrolled' set; 5)a withdrawStudent method that removes a given Student object from the 'enrolled' set and returns true if the student was successfully found and removed,...

  • (Java Problem)In this question we will step you through implementing classes and methods in Java for...

    (Java Problem)In this question we will step you through implementing classes and methods in Java for a new ride-sharing app called Rebu. Rebu connects passengers looking for a ride with drivers in their area. You can assume that the classes or methods in earlier questions “exist” in later questions, even if you haven’t answered the question. You must follow proper Object Oriented Design principles, and Java programming conventions. Write all class declarations. Do not write method signatures that are given...

  • Programming Assignment 5: UML Diagram Objectives: After successfully completing this assignment, students will practice Object Oriented...

    Programming Assignment 5: UML Diagram Objectives: After successfully completing this assignment, students will practice Object Oriented design by creating an UML diagram for a Java program. Program Statement: Bank System You were asked to create a simple UML diagram for a bank system. Each bank has a specific identification number, a name, and a location that needs to be stored. Tellers serve customers’ loans, checking and savings accounts. The bank must know each tellers’ name and identification number for record...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT