Classes and objects | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Classes and objects

Let’s consider a digital wristwatch as an object. We can consider it being composed of a battery, an LCD display, time, and date. Typical operations that can be done on the watch include turning it on or off, it can turn on when the battery has enough power (> 5%). When it is on, a user can check the time, the time is displayed on the screen. They can set the time (hrs and minutes) as well as set the date (day, month, and year). The battery is rechargeable that when the watch is connected to a charger, it increases the capacity of the battery. Use this information to answer the questions that follow. .Create classes for the objects,  battery, display, time, and date. Implement their respective attributes and operational behaviours. Create a class digital clock that demonstrates the composition relationship or aggregation relationship with the classes implemented in (a). Implement a constructor that enables the initialisation of the digital clock to have the the time date and battery capacity to 90%

26th Mar 2024, 9:11 AM
Daniel Kachisuzi
Daniel Kachisuzi - avatar
7 Antworten
+ 2
your code?
26th Mar 2024, 12:27 PM
Bob_Li
Bob_Li - avatar
+ 1
Daniel Kachisuzi , I'm really not that into Java. I prefer Python. But nobody else gave you anything, so here's a link that will get you a little closer. It's the Classes section of the official Java tutorial from oracle.com. https://docs.oracle.com/javase/tutorial/java/javaOO/index.html
31st Mar 2024, 4:09 AM
Rain
Rain - avatar
0
Need help on this people
26th Mar 2024, 9:11 AM
Daniel Kachisuzi
Daniel Kachisuzi - avatar
0
In Java
27th Mar 2024, 12:07 PM
Daniel Kachisuzi
Daniel Kachisuzi - avatar
0
which programming language?
27th Mar 2024, 4:50 PM
Alhaaz
Alhaaz - avatar
0
I need some friends
28th Mar 2024, 5:12 AM
Jame—rubbe
0
I need some friends
28th Mar 2024, 5:12 AM
Jame—rubbe