Question: What am I doing wrong? package lab1; import java.util.*; public class SharesInvestment_Vimil { public static void main(String[] args) { Scanner sc = new Scanner(System. in
What am I doing wrong?
package lab1;
import java.util.*;
public class SharesInvestment_Vimil
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
//Input
String name = sc.nextLine();
int shares = sc.nextInt();
float price = sc.nextFloat();
float prct = sc.nextFloat();
//Calculations
float tmi = price * shares;
float total = tmi + tmi * prct;
//Output
System.out.println("----------------------------------------------");
System.out.println("SharesInvestment_Vimil.java");
System.out.println("Investment Application - Vaibhav Vimil");
System.out.println("----------------------------------------------");
System.out.println("Name of investor: " + name );
System.out.println("Number of shares: " + shares );
System.out.println("Price of each share: " + price );
System.out.println("Percentage yearly divided: " + prct );
System.out.println("----------------------------------------------");
System.out.println("Total money at the end of year: " + total );
sc.close();
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
