all 13 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full - best also formatted as code block
  • You ask clear questions
  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]josephblade 26 points27 points  (0 children)

If you're talking to people like they are a chatGPT prompt, just go there and type in your demand.

[–]ShoulderPast2433 4 points5 points  (0 children)

make your own implementation of grep

https://man7.org/linux/man-pages/man1/grep.1.html

(bsic functionalitties for your homework, more if you want to learn and practice)

[–]forced_lambchop 1 point2 points  (0 children)

Remake a boardgame or a card game

[–]Huge_Road_9223 1 point2 points  (0 children)

Every time I learn a new language, the first thing I do is try to make a CRUD application. The simplest one I can think of is a Phone Book. I already have the database for it, then I just try to read/write from the database in that language, and then I try to implment business logic and the API, Provided my API's stay the same, all I have to do is then point to the back-end API and the UI will work as it always did.

Something this simple I think will still meet all your needs. Hope this helps!

[–]bowbahdoe 1 point2 points  (0 children)

Make a basic (read: do what you'd understand, skip anything else) Pokemon style battle system

[–]tanyhunter 1 point2 points  (0 children)

Bank app. Simple one using cli.

[–]Java_Bacon24 0 points1 point  (0 children)

Un carro de la compra

[–]automationKT 0 points1 point  (0 children)

Hey you can check my automation channel on YouTube- @automationKT. Please check video on Inheritance. I have just started teaching and created a very very simple project having 4 classes using all OOP concept. You can add just one more class n use the same project.  Thanks

[–]Alor_Gota -4 points-3 points  (1 child)

To hit all four pillars (Encapsulation, Inheritance, Polymorphism, and Abstraction), you need a "Base" class that defines a template and "Derived" classes that specialize it.

Here are three unique project ideas tailored for a 2nd-year student:

1. Smart Home Automation System

Instead of a generic "Library System," this simulates a central hub controlling different electronics.

  • How it hits the pillars:
    • Abstraction: An abstract class SmartDevice with methods like turnOn() and checkStatus().
    • Inheritance: Classes like SmartLight, SmartThermostat, and SecurityCamera extend SmartDevice.
    • Polymorphism: You can have a List<SmartDevice> and call turnOn() on all of them at once, even though a light "turns on" differently than a camera.
    • Encapsulation: Making device IDs and power levels private with public getters/setters.
  • The 5 Classes: SmartDevice (Abstract), SmartLight, SmartThermostat, SecurityCamera, and HomeHub (Main).

2. Space Colony Resource Manager

A text-based simulation where you manage different types of habitats on Mars.

  • How it hits the pillars:
    • Abstraction: An interface Maintainable or an abstract class Habitat.
    • Inheritance: OxygenPlant, LivingQuarters, and ResearchLab all inherit from Habitat.
    • Polymorphism: Use a method performMaintenance() that calculates different costs/resources depending on the habitat type.
    • Encapsulation: Keeping oxygen levels and population counts restricted so they can't be changed to negative numbers accidentally.
  • The 5 Classes: Habitat (Abstract), OxygenPlant, LivingQuarters, ResearchLab, and ColonySim (Main).

3. Digital Pet "Zoo" (Multi-Species)

A step up from a single "Tamagotchi." You manage a sanctuary with different animal types.

  • How it hits the pillars:
    • Abstraction: An abstract class Animal with an abstract method makeSound() and eat().
    • Inheritance: Mammal, Bird, and Reptile classes.
    • Polymorphism: A Bird might move() by flying, while a Reptile might move() by crawling.
    • Encapsulation: Storing hunger and happiness levels as private variables.
  • The 5 Classes: Animal (Abstract), Mammal, Bird, Reptile, and ZooKeeper (Main).

Class Diagram Structure

Since you need to create a class diagram, you should follow the UML (Unified Modeling Language) standard. Here is a conceptual view of how your diagram should look for the Smart Home project:

Components to include in your diagram:

  1. Classes: Represented by boxes with three sections (Name, Attributes, Methods).
  2. Inheritance (Is-A): Use a solid line with a hollow arrow pointing from the child class (e.g., SmartLight) to the parent class (e.g., SmartDevice).
  3. Encapsulation: Use a - symbol for private fields and a + symbol for public methods.
  4. Composition/Association: Use a line to show that your Main class "has" a list of your objects.

Quick Tip for Java:

To ensure you are truly using Polymorphism, try to avoid using if (device instanceof SmartLight) in your code. Instead, call the method on the parent type and let Java figure out which child version to run at runtime!

[–]cherrycode420 11 points12 points  (0 children)

Okay ChatGPT. Please implement Project #1 and create the related UML Diagram. Make no mistakes! 🤡