A fun mini project in Java. Uses Interface, Inheritance, and other OOP concepts

Overview

Sequences---Arithmetic-and-Geometric

Java Sequences

A fun mini project in Java.
Uses Interface, Sorting, Inheritance, and other OOP concepts

About this project:

This project will give an insight on sequences and series.

First Part:

Our first part is an interface, which sets the behaviour up for our parent class.
Our interface, Initialize, will setup behaviour for seeing wheter the interface is an arithmetic, geometric sequence, or neither, and then return true or false for that
We finally have a String method to setup the behaviour for the type.

Second Part:

Our second part is the parent class, Sequence, which implements Initialize, which is our interface. For the instance variable, I made a protected array of integers. I made it protected, so that that our subclass, which is in the third part, can build on the variable.
Our constructor will take in our protected instance variable and then use insertion sort in order to sort our array of random order into ascending order.
We can see that this has formed a sequence that is in increasing manner.
After that, we have implemented the interface and written the methods that we were supposed to write, including a void method that I used so that the array is only printed once.

Third Part:

Our third part is the child class. The child class, Internal, will extend our Parent Class, Sequence.
Now, we have all the methods that we need and some additionals.
For the constructor, I just said to call to Sequence by using the super keyword.
I also used the super keyword in the method and because our instance variable is protected(can be viewed through subclasses), to make sure that our algorihm is sorted.
This class will return the common difference and common ratio depending on the sequence.

Fourth Part:

Our fourth part is our main method code. In the main method, I created instances of both the parent and child class, so that we could use the Child Class methods.
If the sequence is Arithmetic, then return the name of the sequence, and then the common differene.
If the sequence is Geometric, then return the name of the sequence, and then the common ratio.
Otherwise, print that it is neither Arithmetic or Geometric at the same time

Note:

Interface might have not been neccessary, however, since I'm new to the concept of interfaces, I did this as a practice type...

You might also like...

Java SQL (JDBC) code generator with GUI. SQL and OOP finally united.

Java SQL (JDBC) code generator with GUI. SQL and OOP finally united.

jSQL-Gen Java SQL (JDBC) code generator with GUI. SQL and OOP finally united. Usage Install the latest release. Create a database, tables and their co

Nov 14, 2022

This repository will contain useful matriel and source code for OOP exam.

This repository will contain useful matriel and source code for OOP exam.

PrepForOopExam Hello everyone! I assume that you're currently studying for your OOP exam and you are probably tired from exercise 5 , don't know how o

Sep 20, 2022

Lightweight and Necessary utilities for mini minecraft server

Lightweight and Necessary utilities for mini minecraft server

WithMyFriends Lightweight server tools for minimal servers. Contributing to us Version Strategy Why? Despite a huge amount of Server Essential Plugins

Mar 4, 2022

Experimental validation mini-framework

ClinQ Simple yet interesting validation mini-framework Features Declarative checks ClinQ.checker(Integer.class) .with(i - i % 2 == 0) .with(i

Sep 27, 2022

An Open-Source repository 🌎 that contains all the Data Structures and Algorithms concepts and their implementation, programming questions and Interview questions

An Open-Source repository 🌎 that contains all the Data Structures and Algorithms concepts and their implementation, programming questions and Interview questions

An Open-Source repository 🌎 that contains all the Data Structures and Algorithms concepts and their implementation, programming questions and Interview questions. The main aim of this repository is to help students who are learning Data Structures and Algorithms or preparing for an interview.

Dec 29, 2022

A fun way to learn Camunda and win a small price

A fun way to learn Camunda and win a small price

Camunda-Coding-Challenge A fun way to learn about Camunda and win a small prize. The coding challenge is designed for the Camunda Code Studio. Results

Oct 2, 2021

Fun little program to generate worlds in Excel

Basic world generation for Excel! How to use (For windows): Download the latest release from Releases run java -jar WorldGenExcelVersion.jar "path_to_

Feb 12, 2022

Operating Systems - Concepts of computer operating systems including concurrency, memory management, file systems, multitasking, performance analysis, and security. Offered spring only.

Nachos for Java README Welcome to Nachos for Java. We believe that working in Java rather than C++ will greatly simplify the development process by p

Nov 28, 2021

Learning and improving skills in Object Oriented Programming, with concepts from the Spotify App

 Learning and improving skills in Object Oriented Programming, with concepts from the Spotify App

sPOOtify Screenshot EN A project developed in the discipline of Object Oriented Programming, to apply and improve the concepts of Object Orientation.

Jan 2, 2023
Owner
Urjit Aich
A 15-year-old who likes to code in Python, Javascript, Java, C#, and C++.
Urjit Aich
A java mini project the "Currency Convertor".

Currency Convertor A Currency Convertor made using Java. Description This “Currency Convertor” Core Java Mini-Project is simply a calculator-like app

Aryan Agarwal 2 Oct 19, 2021
Java, Spring Boot Mini Project - Library Management System - Free Download

Java, Spring Boot Mini Project - Library Management System Local setup Step 1: Download or clone the source code from GitHub to the local machine Step

Sibin Rasiya 15 Dec 27, 2022
a simple mini-project using Spring framework

Room Reservation Service First attempts to learn Spring with Linkedin-Learning led me to create this mini-project; a simple room reservation service f

Taha Elmi 4 Sep 23, 2021
The Download Manager uses a simple yet effective GUI interface built with java’s Swing libraries

The Download Manager uses a simple yet effective GUI interface built with java’s Swing libraries.The use of Swing gives the interface a crisp, modern look and feel. The GUI maintains a list of downloads that are currently being managed.

Manish Kumar Mahawar 2 Jan 2, 2022
A Minecraft Mod Loader built as a fun project.

BrassLoader What is BrassLoader? BrassLoader is The next generation of Minecraft Mod Loaders, It primarly loads mods made using our very own BrassAPI!

null 10 Aug 7, 2022
A boilerplate project designed to work as a template for new microservices and help you get in touch with various useful concepts.

Microservice Reference Project This project is inspired by the idea to quickly create a production ready project with all the required infrastructure

Innovation & Tech 4 Dec 17, 2022
Java project to explore programming concepts by creating chatting application.

ChitChat - Let's explore programming Abstract ✍️ This project aimed to develop a chatting application from very basic, by exploring the fundamentals o

Sri Manikanta 3 Dec 23, 2022
A sideproject to learn more about object-oriented programming, design patterns and Java meanwhile studying an OOP-course.

MyBank Description A console application that simulates a bank with very simple functions. Potential story could be an employee using this application

null 2 Mar 23, 2022
The goal of this topic is learning OOP principles in Java and modifying elements in 2D arrays.

Homework #11 Table of Contents General Info Technologies Used Project Status Contact General Information Homework contains two topics: Generating rand

Mykhailo 1 Feb 2, 2022