write 10 class example for each of easy , medium and hard , so that I can ask a question in a coding test exam
Assistant
For coding test exams, it often helps to categorize questions by difficulty to progressively test the candidates' abilities. Here are examples of easy, medium, and hard class-based problems you might consider.
Easy
Person Class: Implement a class called Person with attributes like name, age, and a method to display person information.
Calculator Class: Create a basic calculator class that can perform simple arithmetic operations like add, subtract, multiply, and divide given two numbers.
Car Class: Design a class named Car with attributes like model, year, and a method that displays a description of the car.
Student Class: Implement a class that represents a student with properties such as student ID, name, and grade.
BankAccount Class: Design a class to represent a bank account, including attributes like account number, balance, and methods to deposit and withdraw funds.
Rectangle Class: A simple class that represents a rectangle with methods to calculate its area and perimeter.
Book Class: Create a class to hold information about a book, including the title, author, and a method to display this information.
TemperatureConverter Class: Develop a class that can convert temperatures between Celsius and Fahrenheit.
EmailValidator Class: Write a class with a method to validate an email format without using regex (regular expressions), focusing on simple criteria.
Employee Class: A basic class that includes information about an employee such as name, position, and a method to display this information.
Medium
Shape Interface and Subclasses: Design an interface for shapes, and implement it in subclasses like Circle, Rectangle, and Triangle, each with methods to calculate area and perimeter.
InventoryManager Class: A class that manages an inventory of products, including methods to add, remove, and search products.
CourseRegistration System: Implement a class to manage course registrations, dealing with students, courses, and enrollments.
LibraryManagement System: Design classes for a simple library management system where you can add books, borrow books, and return books.
Stack Class: Implement a generic stack class from scratch, providing methods for push, pop, peek, and check if empty.
Queue Class: Similarly, implement a generic queue class with methods for enqueue, dequeue, and size.
LinkedList Class: Write a singly linked list class from scratch with basic operations like append, delete, and find.
ChatApp User Management: Design a system for managing users in a chat application, including storing usernames, online status, and sent messages.
BankingSystem Class: Implement a banking system class with more features, including support for multiple account types, interest rates, and transactions.
ToDoList App Class: A class to implement a ToDoList where tasks can be added, marked as done, and removed.
Hard
Graph Class: Implement a graph class from scratch, supporting both directed and undirected graphs, including methods for adding vertices, edges, and finding paths.
FileSystem Class Simulation: Write a class to simulate a file system, supporting operations like create file, create directory, list directory contents, and move files.
ConcurrentBankAccount Class: A thread-safe bank account class that can handle concurrent deposits and withdrawals without causing data inconsistency.
MachineLearning Model Class: Design a basic framework for a machine learning model class, including methods for training, prediction, and evaluation.
WebCrawler Class: Implement a simple web crawler that can fetch pages, follow links, and collect specific data from web pages.
DatabaseManagement System: Write a class to simulate a basic database management system, capable of storing records, creating tables, and performing simple queries.
Cache Implementation: Design a cache system using classes, supporting features like maximum size, eviction policies (e.g., LRU, FIFO).
RegularExpression Engine Class: A challenging task to implement a simple regex engine that can handle basic patterns and matching operations.
GameEngine for a Board Game: Implement a class that serves as the game engine for a board game, managing game state, player turns, and victory conditions.
AutocompleteSystem Class: Create an autocomplete system that suggests words based on a prefix, integrating with a dictionary and prioritizing suggestions based on past usage or frequency.
Each of these examples varies in complexity and incorporates different programming concepts, making them suitable for a variety of testing environments and objectives.