Skip to content

yusuftechx/investment-tracker-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Investment Tracker App

This code is for a simple investment tracking application that calculates daily and total earnings of an investment over 7 days period.

How it works:

  1. The user is prompted to enter the buying price per share.
  2. The user is then prompted to enter the closing price for each day of the week (7 days).
  3. For each day, the application calculates the earnings by subtracting the buying price from the closing price.
  4. The earnings are stored in an array weekly.
  5. The application then prints out a message indicating whether the investment has gained, lost, or broken even for each day.
  6. After all 7 days, the application calculates the total weekly earnings by summing up the earnings for each day.
  7. The total weekly earnings are printed out to the console.

Variables and Data Structures:

  • buyingPrice: The buying price per share.
  • closingPrice: The closing price for each day.
  • weekly: An array of doubles to store the earnings for each day.
  • day: An integer variable to keep track of the current day.
  • i: An integer variable to iterate through the weekly array.
  • j: An integer variable to iterate through the weekly array in the second loop.
  • totalWeeklyEarnings: A double variable to store the total weekly earnings.

Methods:

  • Scanner to read input from the user.
  • System.out.println and System.out.printf to print output to the console.
  • Arrays to store and manipulate the weekly array.

Code Output On Console:

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages