Wednesday, April 20, 2022

Simple Interest Using Scala

 Machine Problem

Write a  simple interest program that will ask the principal amount, rate of the loan, and a number of years.  The program will compute the interest rate of the loan of the customer and display the results on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.


My mobile number here in the Philippines is 09173084360.


Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg


=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support




Program Listing

/* Simple_Interest.scala

   Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

   www.jakerpomperada.blogspot.com and www.jakerpomperada.com

   jakerpomperada@gmail.com

   November 12, 2021  2:22 PM Friday

   Bacolod City, Negros Occidental

 */



import java.util.Scanner;


object Simple_Interest {


  def main(args: Array[String]) : Unit = {


    var input = new Scanner(System.in);


    print("\n\n");

    print("\tSimple Interest Using Scala");

    print("\n\n");

    print("\tEnter the Principal Amount  : ");

    var principal = input.nextDouble();


    print("\tEnter Rate                  : ");

    var rate = input.nextDouble();


    print("\tEnter Time (No. of Years)  : ");

    var time = input.nextDouble();


    var interest = (principal * time * rate) / 100;


    print("\n");

    print("\tThe Principal Amount     : PHP  " + f"$principal%5.2f" );

    print("\n");

    print("\tThe Interest Rate        :      " + f"$rate%5.0f" + "%");

    print("\n");

    print("\tThe Time Duration        :      " + f"$time%5.0f");

    print("\n");

    print("\tThe Simple Interest      : PHP  " + f"$interest%5.2f" );

    print("\n\n");

    print("\tEND OF PROGRAM");

    print("\n\n");

  }

}


No comments:

Post a Comment