SlideShare a Scribd company logo
1 of 1
Download to read offline
In java - Owners and Computers
Create a java program that will model the relationship between a person and the computer they
own. The program should be able to record personal information about the Person who owns the
computer and also details about the Computer itself.
1)Create a new project with a driver class called ComputerDriver. Add 2 other classes called
Person and Computer. The Computer class should have the attributes make and model . Create
a constructor method that takes parameters for make and model. Create getter methods for the
attributes of the class.
2)The Person class should have a persons name attribute. Next create an association between
Computer and Person. To do this the Person class should contain a reference to a Computer
object. Create a constructor method in your Person class that takes parameters for the persons
name and computer. Also create a constructor that takes a parameter for the persons name only.
Create getter methods for the attributes of the class.
3)In the main method of the driver class create a Computer object and a Person object named
person1 and pass the name and computer object as parameters to the constructor of the Person
object. Print the owner name and make and model of his computer. Access all of this information
through the person1 object.
4)Add an attribute that will store a reference to a borrowed computer in the Person class and a
method which allows an owner to borrow a computer. Add an accessor to return the borrowed
computer.
5)Create a new Person object named person2 which has only a name parameter in your main
method. Call the borrowComputer method of the person object and pass the computer object as a
parameter. Print out the name of the borrower and the make and model of the computer using the
person2 object. Print out the owners name using the person1 object.
6)A person may have a number of computers; desktop, laptop, tablet, etc. Allow the Person class
to store a list of all the owners computers. Add an ArrayList to the Person class and a method
which allows an owner to buy a computer and add it to their list of computers. Modify the
constructor to add the computer passed as a parameter to the list of computers. Add an accessor
to return the list of the persons computers.
Note: By adding this array list, an already existing object may become redundant. Discuss this
with your colleagues?
7)In the main method create 2 more computer objects and call the buyComputer() method of the
person1 object to allow them to buy the two computers. Print all of person1s computers.
Output from the program should look similar to the following:
Owner: Ahmed, Computer: Dell Inspiron
Borrower: Ali, Computer: Dell Inspiron, Owner: Ahmed
Ahmed's computers:
Make: Dell, Model: Inspiron
Make: Apple, Model: Ipad
Make: Toshiba, Model: Satellite

More Related Content

Similar to In java Owners and Computers Create a java program that wi.pdf

1 Goals. 1. To use a text file for output and later for in.docx
1 Goals. 1. To use a text file for output and later for in.docx1 Goals. 1. To use a text file for output and later for in.docx
1 Goals. 1. To use a text file for output and later for in.docxhoney690131
 
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEWINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEHitesh Mohapatra
 
Murach': HOW TO DEVELOP A DATA DRIVEN MVC WEB
Murach': HOW TO DEVELOP A DATA DRIVEN MVC WEB Murach': HOW TO DEVELOP A DATA DRIVEN MVC WEB
Murach': HOW TO DEVELOP A DATA DRIVEN MVC WEB MahmoudOHassouna
 
project_proposal_osrf
project_proposal_osrfproject_proposal_osrf
project_proposal_osrfom1234567890
 
Essay On Active Directory
Essay On Active DirectoryEssay On Active Directory
Essay On Active DirectoryTammy Moncrief
 
computer notes - Linked list inside computer memory
computer notes - Linked list inside computer memorycomputer notes - Linked list inside computer memory
computer notes - Linked list inside computer memoryecomputernotes
 
14 asp.net session20
14 asp.net session2014 asp.net session20
14 asp.net session20Vivek chan
 
LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLLearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLAkhil Mittal
 
Both Learning Activities will be posted this weekLearning Activi.docx
Both Learning Activities will be posted this weekLearning Activi.docxBoth Learning Activities will be posted this weekLearning Activi.docx
Both Learning Activities will be posted this weekLearning Activi.docxAASTHA76
 
Python Expense Tracker Project with Source Code.pdf
Python Expense Tracker Project with Source Code.pdfPython Expense Tracker Project with Source Code.pdf
Python Expense Tracker Project with Source Code.pdfabhishekdf3
 
matmultHomework3.pdfNames of Files to Submit matmult..docx
matmultHomework3.pdfNames of Files to Submit  matmult..docxmatmultHomework3.pdfNames of Files to Submit  matmult..docx
matmultHomework3.pdfNames of Files to Submit matmult..docxandreecapon
 
Online eaxmination
Online eaxminationOnline eaxmination
Online eaxminationAditi_17
 
Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6helpido9
 
C++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment InstructionsC++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment InstructionsTawnaDelatorrejs
 
Lecture 2 - Classes, Fields, Parameters, Methods and Constructors
Lecture 2 - Classes, Fields, Parameters, Methods and ConstructorsLecture 2 - Classes, Fields, Parameters, Methods and Constructors
Lecture 2 - Classes, Fields, Parameters, Methods and ConstructorsSyed Afaq Shah MACS CP
 

Similar to In java Owners and Computers Create a java program that wi.pdf (20)

1 Goals. 1. To use a text file for output and later for in.docx
1 Goals. 1. To use a text file for output and later for in.docx1 Goals. 1. To use a text file for output and later for in.docx
1 Goals. 1. To use a text file for output and later for in.docx
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEWINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
 
Murach': HOW TO DEVELOP A DATA DRIVEN MVC WEB
Murach': HOW TO DEVELOP A DATA DRIVEN MVC WEB Murach': HOW TO DEVELOP A DATA DRIVEN MVC WEB
Murach': HOW TO DEVELOP A DATA DRIVEN MVC WEB
 
OOP Programs
OOP ProgramsOOP Programs
OOP Programs
 
project_proposal_osrf
project_proposal_osrfproject_proposal_osrf
project_proposal_osrf
 
Essay On Active Directory
Essay On Active DirectoryEssay On Active Directory
Essay On Active Directory
 
computer notes - Linked list inside computer memory
computer notes - Linked list inside computer memorycomputer notes - Linked list inside computer memory
computer notes - Linked list inside computer memory
 
14 asp.net session20
14 asp.net session2014 asp.net session20
14 asp.net session20
 
LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLLearningMVCWithLINQToSQL
LearningMVCWithLINQToSQL
 
Both Learning Activities will be posted this weekLearning Activi.docx
Both Learning Activities will be posted this weekLearning Activi.docxBoth Learning Activities will be posted this weekLearning Activi.docx
Both Learning Activities will be posted this weekLearning Activi.docx
 
Python Expense Tracker Project with Source Code.pdf
Python Expense Tracker Project with Source Code.pdfPython Expense Tracker Project with Source Code.pdf
Python Expense Tracker Project with Source Code.pdf
 
matmultHomework3.pdfNames of Files to Submit matmult..docx
matmultHomework3.pdfNames of Files to Submit  matmult..docxmatmultHomework3.pdfNames of Files to Submit  matmult..docx
matmultHomework3.pdfNames of Files to Submit matmult..docx
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 
Online eaxmination
Online eaxminationOnline eaxmination
Online eaxmination
 
Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6
 
C++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment InstructionsC++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment Instructions
 
Intro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm ReviewIntro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm Review
 
Lecture 2 - Classes, Fields, Parameters, Methods and Constructors
Lecture 2 - Classes, Fields, Parameters, Methods and ConstructorsLecture 2 - Classes, Fields, Parameters, Methods and Constructors
Lecture 2 - Classes, Fields, Parameters, Methods and Constructors
 

More from absgroup9793

What reacts with C3 to form C3b needed to start the altern.pdf
What reacts with C3 to form C3b needed to start the altern.pdfWhat reacts with C3 to form C3b needed to start the altern.pdf
What reacts with C3 to form C3b needed to start the altern.pdfabsgroup9793
 
Write a C++ program to find the area of circle using class c.pdf
Write a C++ program to find the area of circle using class c.pdfWrite a C++ program to find the area of circle using class c.pdf
Write a C++ program to find the area of circle using class c.pdfabsgroup9793
 
Part 4 10points Calculate ROE Ratio and DuPont Analysis R.pdf
Part 4 10points Calculate ROE Ratio and DuPont Analysis R.pdfPart 4 10points Calculate ROE Ratio and DuPont Analysis R.pdf
Part 4 10points Calculate ROE Ratio and DuPont Analysis R.pdfabsgroup9793
 
Suppose you wanted to study genes controlling the structure .pdf
Suppose you wanted to study genes controlling the structure .pdfSuppose you wanted to study genes controlling the structure .pdf
Suppose you wanted to study genes controlling the structure .pdfabsgroup9793
 
Snap Company issues 12 fiveyear bonds on January 1 of th.pdf
Snap Company issues 12 fiveyear bonds on January 1 of th.pdfSnap Company issues 12 fiveyear bonds on January 1 of th.pdf
Snap Company issues 12 fiveyear bonds on January 1 of th.pdfabsgroup9793
 
Let Y1Yn be iid random variables with pdffy2yexp.pdf
Let Y1Yn be iid random variables with pdffy2yexp.pdfLet Y1Yn be iid random variables with pdffy2yexp.pdf
Let Y1Yn be iid random variables with pdffy2yexp.pdfabsgroup9793
 
Tart ve akla a Bir marka sein ve tm pazarlama iletiimi .pdf
Tart ve akla  a Bir marka sein ve tm pazarlama iletiimi .pdfTart ve akla  a Bir marka sein ve tm pazarlama iletiimi .pdf
Tart ve akla a Bir marka sein ve tm pazarlama iletiimi .pdfabsgroup9793
 
Sonraki soru iin aadaki bilgiler kullanlacaktr Konut H.pdf
Sonraki  soru iin aadaki bilgiler kullanlacaktr  Konut H.pdfSonraki  soru iin aadaki bilgiler kullanlacaktr  Konut H.pdf
Sonraki soru iin aadaki bilgiler kullanlacaktr Konut H.pdfabsgroup9793
 
Question 2 Capital University a midsized university in a ca.pdf
Question 2 Capital University a midsized university in a ca.pdfQuestion 2 Capital University a midsized university in a ca.pdf
Question 2 Capital University a midsized university in a ca.pdfabsgroup9793
 
Question One Tera Hunters scholarship in To Joy my Freed.pdf
Question One  Tera Hunters scholarship in To Joy my Freed.pdfQuestion One  Tera Hunters scholarship in To Joy my Freed.pdf
Question One Tera Hunters scholarship in To Joy my Freed.pdfabsgroup9793
 
QUESTION 1 If your linked list nodes each have a next pointe.pdf
QUESTION 1 If your linked list nodes each have a next pointe.pdfQUESTION 1 If your linked list nodes each have a next pointe.pdf
QUESTION 1 If your linked list nodes each have a next pointe.pdfabsgroup9793
 
Q15 marks Let Hexex halts the halting problem a.pdf
Q15 marks Let Hexex halts  the halting problem a.pdfQ15 marks Let Hexex halts  the halting problem a.pdf
Q15 marks Let Hexex halts the halting problem a.pdfabsgroup9793
 
OntheSpot Courier Services Previous chapters have describe.pdf
OntheSpot Courier Services Previous chapters have describe.pdfOntheSpot Courier Services Previous chapters have describe.pdf
OntheSpot Courier Services Previous chapters have describe.pdfabsgroup9793
 
Please explain this results step by step tI0e+MtI00.pdf
Please explain this results step by step tI0e+MtI00.pdfPlease explain this results step by step tI0e+MtI00.pdf
Please explain this results step by step tI0e+MtI00.pdfabsgroup9793
 
Please complete method pop in python which calls _remove .pdf
Please complete method pop in python which calls _remove .pdfPlease complete method pop in python which calls _remove .pdf
Please complete method pop in python which calls _remove .pdfabsgroup9793
 
Match the terms to their definitionfunction 1 Formed by t.pdf
Match the terms to their definitionfunction 1 Formed by t.pdfMatch the terms to their definitionfunction 1 Formed by t.pdf
Match the terms to their definitionfunction 1 Formed by t.pdfabsgroup9793
 
Indique A B C o D para cada pregunta 1 Para un hotel c.pdf
Indique A B C o D para cada pregunta  1 Para un hotel c.pdfIndique A B C o D para cada pregunta  1 Para un hotel c.pdf
Indique A B C o D para cada pregunta 1 Para un hotel c.pdfabsgroup9793
 
Olay 2 Kltme Arkansas Ouachita lesindeki en byk ivere.pdf
Olay 2 Kltme Arkansas Ouachita lesindeki en byk ivere.pdfOlay 2 Kltme Arkansas Ouachita lesindeki en byk ivere.pdf
Olay 2 Kltme Arkansas Ouachita lesindeki en byk ivere.pdfabsgroup9793
 
Hello I a having an issue with the code written in this ass.pdf
Hello I a having an issue with the code written in this ass.pdfHello I a having an issue with the code written in this ass.pdf
Hello I a having an issue with the code written in this ass.pdfabsgroup9793
 
FIFO yntemini kullanan bir sre maliyetlendirme sistemi i.pdf
FIFO yntemini kullanan bir sre maliyetlendirme sistemi i.pdfFIFO yntemini kullanan bir sre maliyetlendirme sistemi i.pdf
FIFO yntemini kullanan bir sre maliyetlendirme sistemi i.pdfabsgroup9793
 

More from absgroup9793 (20)

What reacts with C3 to form C3b needed to start the altern.pdf
What reacts with C3 to form C3b needed to start the altern.pdfWhat reacts with C3 to form C3b needed to start the altern.pdf
What reacts with C3 to form C3b needed to start the altern.pdf
 
Write a C++ program to find the area of circle using class c.pdf
Write a C++ program to find the area of circle using class c.pdfWrite a C++ program to find the area of circle using class c.pdf
Write a C++ program to find the area of circle using class c.pdf
 
Part 4 10points Calculate ROE Ratio and DuPont Analysis R.pdf
Part 4 10points Calculate ROE Ratio and DuPont Analysis R.pdfPart 4 10points Calculate ROE Ratio and DuPont Analysis R.pdf
Part 4 10points Calculate ROE Ratio and DuPont Analysis R.pdf
 
Suppose you wanted to study genes controlling the structure .pdf
Suppose you wanted to study genes controlling the structure .pdfSuppose you wanted to study genes controlling the structure .pdf
Suppose you wanted to study genes controlling the structure .pdf
 
Snap Company issues 12 fiveyear bonds on January 1 of th.pdf
Snap Company issues 12 fiveyear bonds on January 1 of th.pdfSnap Company issues 12 fiveyear bonds on January 1 of th.pdf
Snap Company issues 12 fiveyear bonds on January 1 of th.pdf
 
Let Y1Yn be iid random variables with pdffy2yexp.pdf
Let Y1Yn be iid random variables with pdffy2yexp.pdfLet Y1Yn be iid random variables with pdffy2yexp.pdf
Let Y1Yn be iid random variables with pdffy2yexp.pdf
 
Tart ve akla a Bir marka sein ve tm pazarlama iletiimi .pdf
Tart ve akla  a Bir marka sein ve tm pazarlama iletiimi .pdfTart ve akla  a Bir marka sein ve tm pazarlama iletiimi .pdf
Tart ve akla a Bir marka sein ve tm pazarlama iletiimi .pdf
 
Sonraki soru iin aadaki bilgiler kullanlacaktr Konut H.pdf
Sonraki  soru iin aadaki bilgiler kullanlacaktr  Konut H.pdfSonraki  soru iin aadaki bilgiler kullanlacaktr  Konut H.pdf
Sonraki soru iin aadaki bilgiler kullanlacaktr Konut H.pdf
 
Question 2 Capital University a midsized university in a ca.pdf
Question 2 Capital University a midsized university in a ca.pdfQuestion 2 Capital University a midsized university in a ca.pdf
Question 2 Capital University a midsized university in a ca.pdf
 
Question One Tera Hunters scholarship in To Joy my Freed.pdf
Question One  Tera Hunters scholarship in To Joy my Freed.pdfQuestion One  Tera Hunters scholarship in To Joy my Freed.pdf
Question One Tera Hunters scholarship in To Joy my Freed.pdf
 
QUESTION 1 If your linked list nodes each have a next pointe.pdf
QUESTION 1 If your linked list nodes each have a next pointe.pdfQUESTION 1 If your linked list nodes each have a next pointe.pdf
QUESTION 1 If your linked list nodes each have a next pointe.pdf
 
Q15 marks Let Hexex halts the halting problem a.pdf
Q15 marks Let Hexex halts  the halting problem a.pdfQ15 marks Let Hexex halts  the halting problem a.pdf
Q15 marks Let Hexex halts the halting problem a.pdf
 
OntheSpot Courier Services Previous chapters have describe.pdf
OntheSpot Courier Services Previous chapters have describe.pdfOntheSpot Courier Services Previous chapters have describe.pdf
OntheSpot Courier Services Previous chapters have describe.pdf
 
Please explain this results step by step tI0e+MtI00.pdf
Please explain this results step by step tI0e+MtI00.pdfPlease explain this results step by step tI0e+MtI00.pdf
Please explain this results step by step tI0e+MtI00.pdf
 
Please complete method pop in python which calls _remove .pdf
Please complete method pop in python which calls _remove .pdfPlease complete method pop in python which calls _remove .pdf
Please complete method pop in python which calls _remove .pdf
 
Match the terms to their definitionfunction 1 Formed by t.pdf
Match the terms to their definitionfunction 1 Formed by t.pdfMatch the terms to their definitionfunction 1 Formed by t.pdf
Match the terms to their definitionfunction 1 Formed by t.pdf
 
Indique A B C o D para cada pregunta 1 Para un hotel c.pdf
Indique A B C o D para cada pregunta  1 Para un hotel c.pdfIndique A B C o D para cada pregunta  1 Para un hotel c.pdf
Indique A B C o D para cada pregunta 1 Para un hotel c.pdf
 
Olay 2 Kltme Arkansas Ouachita lesindeki en byk ivere.pdf
Olay 2 Kltme Arkansas Ouachita lesindeki en byk ivere.pdfOlay 2 Kltme Arkansas Ouachita lesindeki en byk ivere.pdf
Olay 2 Kltme Arkansas Ouachita lesindeki en byk ivere.pdf
 
Hello I a having an issue with the code written in this ass.pdf
Hello I a having an issue with the code written in this ass.pdfHello I a having an issue with the code written in this ass.pdf
Hello I a having an issue with the code written in this ass.pdf
 
FIFO yntemini kullanan bir sre maliyetlendirme sistemi i.pdf
FIFO yntemini kullanan bir sre maliyetlendirme sistemi i.pdfFIFO yntemini kullanan bir sre maliyetlendirme sistemi i.pdf
FIFO yntemini kullanan bir sre maliyetlendirme sistemi i.pdf
 

Recently uploaded

Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxLimon Prince
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesPooky Knightsmith
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxCeline George
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 

Recently uploaded (20)

Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 

In java Owners and Computers Create a java program that wi.pdf

  • 1. In java - Owners and Computers Create a java program that will model the relationship between a person and the computer they own. The program should be able to record personal information about the Person who owns the computer and also details about the Computer itself. 1)Create a new project with a driver class called ComputerDriver. Add 2 other classes called Person and Computer. The Computer class should have the attributes make and model . Create a constructor method that takes parameters for make and model. Create getter methods for the attributes of the class. 2)The Person class should have a persons name attribute. Next create an association between Computer and Person. To do this the Person class should contain a reference to a Computer object. Create a constructor method in your Person class that takes parameters for the persons name and computer. Also create a constructor that takes a parameter for the persons name only. Create getter methods for the attributes of the class. 3)In the main method of the driver class create a Computer object and a Person object named person1 and pass the name and computer object as parameters to the constructor of the Person object. Print the owner name and make and model of his computer. Access all of this information through the person1 object. 4)Add an attribute that will store a reference to a borrowed computer in the Person class and a method which allows an owner to borrow a computer. Add an accessor to return the borrowed computer. 5)Create a new Person object named person2 which has only a name parameter in your main method. Call the borrowComputer method of the person object and pass the computer object as a parameter. Print out the name of the borrower and the make and model of the computer using the person2 object. Print out the owners name using the person1 object. 6)A person may have a number of computers; desktop, laptop, tablet, etc. Allow the Person class to store a list of all the owners computers. Add an ArrayList to the Person class and a method which allows an owner to buy a computer and add it to their list of computers. Modify the constructor to add the computer passed as a parameter to the list of computers. Add an accessor to return the list of the persons computers. Note: By adding this array list, an already existing object may become redundant. Discuss this with your colleagues? 7)In the main method create 2 more computer objects and call the buyComputer() method of the person1 object to allow them to buy the two computers. Print all of person1s computers. Output from the program should look similar to the following: Owner: Ahmed, Computer: Dell Inspiron Borrower: Ali, Computer: Dell Inspiron, Owner: Ahmed Ahmed's computers: Make: Dell, Model: Inspiron Make: Apple, Model: Ipad Make: Toshiba, Model: Satellite