Skip to content

AKushch1337/SDMaT-lab1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 

Repository files navigation

Quadratic Equation Solver (QES)

The Kotlin CLI app to solve quadratic equations

View the code here.


Description

This application is designed to solve quadratic equations of the form $ax^2+bx+c=0$, where $a \neq 0$. It calculates the roots of the equation and displays them. There are two different modes available to use the application:

  1. Interactive mode - the application asks the user to enter the coefficients of the equation and prints the roots.

  2. Non-interactive mode - the application takes the coefficients from input TXT-file argument and prints the roots.

Setup

  • Download Kotlin compiler here

  • Extract the archive on your computer

  • Add the Kotlin bin folder to your system's PATH environment variable. Open the command prompt (CMD) and run the following command:

setx /M PATH "%PATH%;C:\path\to\kotlin\bin"
  • Replace "C:\path\to\kotlin" with the path to the folder where you extracted the Kotlin compiler.

NOTE: You can add Kotlin bin folder to your system's PATH environment variable using Windows UI tools. Click here to see the instructions.

  • Verify that the Kotlin compiler is installed correctly by running the following command in the command prompt:
kotlinc -version
  • Verify that you have Java Runtime Environment(JRE) on your computer

Build the project

  • Clone the project on your computer.
git clone https://github.com/AKushch1337/SDMaT-lab1
  • Move into the folder where you cloned the project

  • Open the command prompt (CMD) and run the following command:

kotlinc *.kt -include-runtime -d quadratic-equation-solver-cli.jar

NOTE: You can replace quadratic-equation-solver-cli with whatever name you want

  • This will generate .jar file which you can run using Java Runtime Environment(JRE)

NOTE: You can skip the "Build the project" part and just download the .jar file =)

Download the .jar file

Run the .jar file

In interactive mode

java -jar \path\to\runtime\file\quadratic-equation-solver-cli.jar

In non-interactive mode

java -jar \path\to\runtime\file\quadratic-equation-solver-cli.jar \path\to\file\with\inputs

How should the .txt file look like

When the application is in non-interactive mode it expects a single argument that specifies the path to the file containing the coefficients of the equation. The file should have three numbers separated by a single space, representing the coefficients a, b, and c of the equation. Here's an example of how the numbers should be formatted in the file.

Link to revert commit

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages