Question: Java Error: Variable 'total' is assigned but never accessed Also Not able to execute my program please look at it. import java.util.Scanner; public class Program5A

Java Error:" Variable 'total' is assigned but never accessed" Also Not able to execute my program please look at it. import java.util.Scanner; public class Program5A { public static void main(String[] args) { Scanner input = new Scanner(System.in); char customerType = input.next().charAt(0); System.out.println("Enter customerType:" + customerType); int minutes = input.nextInt(); System.out.println("Enter num of min: "); double total; if (customerType == 'r') { // residential if (minutes <= 60) { System.out.println("$5"); } else // residential minutes over 60 here { total = 0.10 * minutes; } } if (customerType == 'c') { if (minutes <= 300) { total = 0.20 * minutes; } else { total = 0.15 * minutes; } } } } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!