0% found this document useful (0 votes)
6 views11 pages

Object-Oriented Programming Task 3

This document presents an activity for unit 3 of Object-Oriented Programming. The activity consists of completing a UML diagram of the "Hat" class by identifying its attributes and methods based on the provided information. It also includes instructions for answering four questions related to the creation of objects of the "Hat" class and the use of its attributes and methods. Finally, it asks to develop a Java program for the "Hat" class that meets the requirements.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views11 pages

Object-Oriented Programming Task 3

This document presents an activity for unit 3 of Object-Oriented Programming. The activity consists of completing a UML diagram of the "Hat" class by identifying its attributes and methods based on the provided information. It also includes instructions for answering four questions related to the creation of objects of the "Hat" class and the use of its attributes and methods. Finally, it asks to develop a Java program for the "Hat" class that meets the requirements.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

lOMoARcPSD|12618438

Name of the subject


Object-Oriented Programming

Name of the Bachelor's Degree


Computer Systems Engineering

Student's name
Jackson palace

Enrollment
200411039

Task Name
Task 3

Unit # 3
Object-Oriented Programming

Name of the Teacher


Edgar Calleros

Date
22/01/2023
lOMoARcPSD|12618438

Unit #: 3
Object-Oriented Programming

ACTIVITY 3
CLASS
HAT

The variables that refer to local objects and their values are stored in memory.
pila, while the objects they point to are stored in dynamic memory space
(heap)
Sun Microsystems

Objectives:

Practice analysis, design, and development using Object-Oriented Programming.


through an exercise where the knowledge acquired up to unit 3 will be used

Instructions:

Review the materials corresponding to the resources for week 3, as well as the previous Open Classes and
of the current week that the subject teachers have taught.

Assessment method:

Criterion Weighting

Presentation. 10%

Occupying the proposed work format by


the University develops a clear document and
well written, taking care of the spelling and

correctly presenting each section:


Introducción, Desarrollo, Conclusiones y
Bibliography.
Evidence of the code. 50%

The program code is sent in Java, to


through a compressed file or project and
this runs correctly, that is, it
meet 100% of the requirements
requested in the problem to be solved and with
lOMoARcPSD|12618438

Unit #:3
Object-Oriented Programming

the requested outputs. Include in the code


name, registration, date, and comments of the
most important processes.
Evidence in document. 40%

An introduction to the activity is included.


drafted by the student, which must define
the theoretical framework within which is developed the

activity.

In the development of the submitted activity,


contains screenshots of the code in
Java and its execution, both in
successful and unsuccessful runs at 100% of the
problem raised in this document. It
pay close attention to the date and time in those
images. It clearly explains the way to
carry out the activity and how it was resolved
the inconveniences encountered.

The conclusions are written by the


student and clearly reflect that
the student achieved meaningful learning
with this activity.

The presented bibliography is consistent with the


quotes that are included in the document and it is

presented in APA format and in order


alphabetical.

Development of the activity:


A. Resolution of the questions and the program posed in the problem, using the paradigm
Object-Oriented and done in your preferred programming IDE, it can be Eclipse,
Apache NetBeans, BlueJ, Intellij IDEA, etc.
B. You must send the compressed project in .zip, .rar, or .7z.
C. You must also send in a Word document all the screens of the code where you comment.
each of the most important processes of the program and you must also include as
documentation comments: your name, registration number and date of completion of the program. The
lOMoARcPSD|12618438

Unit #: 3
Object-Oriented Programming

Word document must also include execution screens of the program, where it can be
corroborate the date and time of execution. If you have a programming IDE that does not
throw the date and time at the moment of the run, so the date and time of your must be noted
computer, for example:

It is important to highlight that not only should screens of successful executions be included, but also

also from those where the program did not function correctly and in the Development of the
actividad debes comentar cómo hiciste para corregirlas.
D. The document must include Introduction, Development, Conclusions, and Bibliography in APA format.
The introduction of your work must contain at least half a page, where it explains the
importance of object-oriented programming, the creation of objects, the definition of
object diagram created in UML, the importance of attributes and methods.
Elaborar por lo menos media página de conclusión donde se expresen, los beneficios de la
object-oriented programming, the experience of developing the hat class and what it
Can you recommend how to identify each of the elements of object-oriented programming?
objects. Keep in mind that this activity is evaluated with a weighting of 15% of the grade.

Remember that everything must be written by you, it should not be copied and pasted from any website.
lOMoARcPSD|12618438

Unit #:3
Object-Oriented Programming

Problem to be solved

HAT CLASS

I.- INSTRUCTIONS. According to the class


hat, identify what the attributes are and
What are the methods that are found in
the box in figure 3.1. and with that information
complete the UML diagram which is a diagram of
class presented in figure 3.2. It is
important that you specify the data type of the
attributes and return data type of the methods
that you consider, as well as the modifier of
visibility of both.
Attribute and method box.
color, Quitar(), talla, Poner(); Limpiar(); modelo;
idSombrero; Colgar()

Figure 3.1 Box of attributes and methods

UML class diagram


hat
Hat
+ idSombrero (int)
+color (String)
+ talla (String)
+ model (String

Remove ()
+ Put ()
+ Clean ()
Hang

Figure 3.2 Diagram


Class UML
hat
lOMoARcPSD|12618438

Unit #:3
Object-Oriented Programming

II.- INSTRUCTIONS. Underline which of the following lines is creating an object of the
Hat class

1 public static void main (String args[])

2 public class Sombrero() {

3Hat myHat = new Hat();

III.- INSTRUCTIONS. Indicate which of the following lines of code indicates 'the call to a method' of the
hat class

[Link]=”blanco”;2

[Link]();

3 [Link]= ’L’;
lOMoARcPSD|12618438

Unit #:3
Object-Oriented Programming

IV.- INSTRUCTIONS. Develop the Java program for the class "Hat" that corresponds to the
UML diagram of the INSTRUCTIONS I, (figure 3.2) corresponding to the class diagram Hat.
E. You must define the attributes and create the corresponding methods for the hat class.
F. Create at least three hat objects with differences in their attributes and execute the methods of the
Hat class for each one.
Example output of the program of an object of the Hat class, remember that you must create at least
three distinct objects:

ID del Sombrero: 2235


Texan Model
Talla: 6
Color: Negro
The hat has been taken down
The hat is on its owner's head
The hat has been taken off the head of its owner
The hat has been cleaned.
The hat has been hung up
Remember that all sources of information used as a reference for the development of the activity must be
to be correctly cited throughout your document and listed in the bibliography.
lOMoARcPSD|12618438

Unit #: 3
Object-Oriented Programming

SOURCE CODE.
MainMethod
public class MetodoMain extends Sombrero{

public static void main(String[] args) {

Hat s1 = new Hat(2530, "White", "Medium", "Beach");

Hat s2= new Hat(2531,"Beige","Large","Rancher");

Hat s3 = new Hat(2532, "Navy Blue", "Small", "Gala");

Sombrero s4= new Sombrero(2533,"Negro","Extra Grande","Rodeo");

[Link]([Link]() + " " + [Link]() + " " + [Link]()


+" "+[Link]()+"\n"+[Link]()+" "+[Link]()+" "+[Link]()+" "+[Link]()
+"\n");

[Link]([Link]() + " " + [Link]() + " " + [Link]())


+ " " + [Link]() + "\n" + [Link]() + " " + [Link]() + " " + [Link]() + " " + [Link]()

[Link]([Link]() + " " + [Link]() + " " + [Link]()


+" "+[Link]()+"\n"+[Link]()+" "+[Link]()+" "+[Link]()+" "+[Link]()

[Link]([Link]() + " " + [Link]() + " " + [Link]()


+ " " + [Link]() + "\n" + [Link]() + " " + [Link]() + " " + [Link]() + " " + [Link]()

}
lOMoARcPSD|12618438

Unit #: 3
Object-Oriented Programming

Hat
public class Hat {

private int hatId;


private String color;
private String talla;
private String model;

public Sombrero() {
}
public Sombrero(int sombreroId, String color, String size, String model) {
[Link] = idSombrero;
[Link] = color;
[Link] = talla;
[Link] = model;
}
public int getHatId() {
return hatId;
}
public void setHatId(int hatId) {
[Link] = idSombrero;
}
public String getColor() {
return color;
}
public void setColor(String color) {
[Link] = color;
}
public String getSize() {
return size;
}
public void setSize(String size) {
[Link] = size;
}
public String getModel() {
lOMoARcPSD|12618438

Unit #: 3
Object-Oriented Programming

return model;
}
public void setModelo(String modelo) {
[Link] = model;
}

public String Poner(){


String ans="Se ha puesto el sombrero \n";
return ans;
}

public String Remove(){


He has taken off the hat
return ans;
}

public String Clear() {


String ans="Se ha limpiado el sombrero \n";
return ans;
}

public String Hang() {


String ans="Se ha colgado el sombrero \n";
return ans;
}
}

REFERENCES.
Basic principles of Object-Oriented Programming in Java (angel70java, 2014)
Object-Oriented Programming(Nereu, 2014).

You might also like