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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started