Using the IDE of your choice, write a method that takes in the price of a sales
ID: 3823987 • Letter: U
Question
Using the IDE of your choice, write a method that takes in the price of a sales item, calculates the final price of the item after applying a 7% sales tax, and prints the final price of the item, compile and test your method, and copy the final code to a file in GitHub under the project that I was invited to collaborate on from the Lab assignments from the week of Jan 23 - 27th, Your final assignment submission should include: 1. a copy in the file format or through text submission of all of the code for the method finished.Explanation / Answer
InterestCalculator.java
import java.util.Scanner;
public class InterestCalculator {
public static void main(String[] args) {
double price;
//Scanner object is used to get the inputs entered by the user
Scanner sc=new Scanner(System.in);
System.out.print("Enter Price of the sales Item :$");
price=sc.nextDouble();
double newPrice=calTax(price);
System.out.println("The New Price after applying tax@7% is : $"+newPrice);
}
/* This method will apply the Tax @7% on the sales Price
* @Params price of double type
* @return newPrice of Double type
*/
private static double calTax(double price) {
double newPrice=price+(price*0.07);
return newPrice;
}
}
___________________
Output:
Enter Price of the sales Item :$500
The New Price after applying tax@7% is : $535.0
______________Thank You
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.