Hi! Newbie Java Programmer here!

I've done a cash register program. this error's pretty unusual to me. i dont know how to fix this.

import java.text.*;
import javax.swing.*;
import java.awt.*;

public class CashRegisterV1
{
    public static void main (String[] args) {

    DecimalFormat fix = new DecimalFormat("0.00");

    //QUANTITIES
    int Nido = 100; 
    int Milo = 100; 
    int Coke = 100; 
    int Sprite = 100; 
    int Royal = 100; 
    //PRICES
    double P_Nido = 68.50;
    double P_Milo = 50.50;
    double P_Coke = 48.50;
    double P_Sprite = 48.50;
    double P_Royal = 48.50;
    //HOLDER
    double HP_Nido = 0;
    double HP_Milo = 0;
    double HP_Coke = 0;
    double HP_Sprite = 0;
    double HP_Royal = 0;

    int SNido = 0;
    int SMilo = 0;
    int SCoke = 0;
    int SSprite = 0;
    int SRoyal = 0;

    int id,response, response2;

int transaction=0;
    do {
    transaction++;
do {


    //DISPLAY FORMATTING
    JTextArea ViewManager = new JTextArea(10,30);
    JScrollPane ViewManager2 = new JScrollPane(ViewManager);

   //LAUNCH SCREEN  
        ViewManager.setText(("Prod ID " + " \tProduct Name " + "\tStocks " + " \tPrice:" +
                (" \n " + "1" + " \t " + "Nido" + "\t" + Nido + "\t " + (fix.format(P_Nido)))+
                (" \n " + "2" + " \t " + "Milo" + "\t" + Milo + "\t " + (fix.format(P_Milo)))+
                (" \n " + "3" + " \t " + "Coke" + "\t" + Coke + "\t " + (fix.format(P_Coke)))+
                (" \n " + "4" + " \t " + "Sprite" + "\t" + Sprite + "\t " + (fix.format(P_Sprite)))+
                (" \n " + "5" + " \t " + "Royal" + "\t" + Royal + "\t " + (fix.format(P_Royal)))+
                ("\n\n\n Choose Product ID :")));
            id=Integer.parseInt(JOptionPane.showInputDialog(null,ViewManager2));

switch(id)

{
    case 1:  int QNido= Integer.parseInt(JOptionPane.showInputDialog("Enter quantity of Nido : "));
             Nido = Nido - QNido;
             HP_Nido = QNido * P_Nido;
             SNido = SNido + QNido;

             ViewManager.setText("Prod ID\t\tProduct Name\t\tQuantity\t\tPrice\t\t\n" + id + "\t\t" + "Nido\t\t" + Nido + "\t\t" + fix.format(HP_Nido));
             JOptionPane.showMessageDialog(null,ViewManager);
             break;

    case 2: int QMilo= Integer.parseInt(JOptionPane.showInputDialog("Enter quantity of Milo : "));
             Milo = Milo - QMilo;
             HP_Milo = QMilo * P_Milo;
             SMilo = SMilo + QMilo; 

             ViewManager.setText("Prod ID\t\tProduct Name\t\tQuantity\t\tPrice\t\t\n" + id + "\t\t" + "Milo\t\t" + Milo + "\t\t" + fix.format(HP_Milo));
             JOptionPane.showMessageDialog(null,ViewManager);
             break;

    case 3: int QCoke= Integer.parseInt(JOptionPane.showInputDialog("Enter quantity of Coke : "));
             Coke = Coke - QCoke;
             HP_Coke = QCoke * P_Coke;
             SCoke = SCoke + QCoke;
             ViewManager.setText("Prod ID\t\tProduct Name\t\tQuantity\t\tPrice\t\t\n" + id + "\t\t" + "Coke\t\t" + Coke + "\t\t" + fix.format(HP_Coke));
             JOptionPane.showMessageDialog(null,ViewManager);
             break;

    case 4:  int QSprite= Integer.parseInt(JOptionPane.showInputDialog("Enter quantity of Sprite : "));
             Sprite = Sprite - QSprite;
             HP_Sprite = QSprite * P_Sprite;
             SSprite = SSprite + QSprite;
             ViewManager.setText("Prod ID\t\tProduct Name\t\tQuantity\t\tPrice\t\t\n" + id + "\t\t" + "Sprite\t\t" + Royal + "\t\t" + fix.format(HP_Sprite));
             JOptionPane.showMessageDialog(null,ViewManager);
             break;

    case 5: int QRoyal = Integer.parseInt(JOptionPane.showInputDialog("Enter quantity of Royal : "));
            Royal = Royal - QRoyal;
            HP_Royal = QRoyal * P_Royal;
            SRoyal = SRoyal + QRoyal;
            ViewManager.setText("Prod ID\t\tProduct Name\t\tQuantity\t\tPrice\t\t\n" + id + "\t\t" + "Sprite\t\t" + Royal + "\t\t" + fix.format(HP_Royal));
             JOptionPane.showMessageDialog(null,ViewManager);
             break;

    default: JOptionPane.showMessageDialog(null, "Product ID not Found", "Error" , JOptionPane.ERROR_MESSAGE);


    }//Brace for Switch
response=Integer.parseInt(JOptionPane.showInputDialog("Do you wish to add more items? [1=Yes]/[0=No]"));

}

//For Payment
        while(response==1);
            JTextArea VMCash = new JTextArea (5,3);
            JScrollPane VMCash2 = new JScrollPane (VMCash);

            VMCash.setText("Total price = " + fix.format(HP_Nido + HP_Milo + HP_Coke + HP_Sprite + HP_Royal) + "\n\n\nEnter cash received");
        double payment = Double.parseDouble(JOptionPane.showInputDialog ( null,VMCash," "));
        double change;

        change = payment - (HP_Nido + HP_Milo + HP_Coke + HP_Sprite + HP_Royal);
        if (change<0)
        {
            JOptionPane.showMessageDialog (null, "Insufficient Amount", "Warning" , JOptionPane.ERROR_MESSAGE); 
            break;
        }   
//Receipt Area

JTextArea myAreaa = new JTextArea(20,20);
        JScrollPane myPanea= new JScrollPane(myAreaa);
         myAreaa.setText(
                    "                      CASH REGISTER V1     \tTransaction No. " + transaction + "\n==================================" 
                    + HP_Nido + HP_Milo + HP_Coke + HP_Sprite + HP_Royal + "\n==================================" 
                    + "\nTotal Sale\t\t" +(fix.format (HP_Nido + HP_Milo + HP_Coke + HP_Sprite + HP_Royal))
                         +"\nTotal\t\t" + (fix.format (HP_Nido + HP_Milo + HP_Coke + HP_Sprite + HP_Royal)) + "\n==================================" 
                    + "\nCash\t\t" +payment+ "\nChange\t\t" + (fix.format(change)));
            JOptionPane.showMessageDialog(null,myPanea,"Receipt",JOptionPane.PLAIN_MESSAGE);    

response2=Integer.parseInt(JOptionPane.showInputDialog("Are you ready to proceed for the next transaction? [1=Yes]/[0=No]"));
}
    while(response2==1);

    ViewManager.setText("\t\t\t SALES REPORT\n " 
                                          + "\n============================================================================================\n"
                                          + "Item ID\t\tItem\t\tStock Left\t\tStock Sold\t\tMoney Earned" 
                                          + "\n1\t\t" + "Nido" + "\t\t" + Nido + "\t\t" + SNido + fix.format(HP_Nido)
                                          + "\n2\t\t" + "Milo" + "\t\t" + Milo + "\t\t" + SMilo+  fix.format(HP_Milo)
                                          + "\n3\t\t" + "Sprite" + "\t\t" + Sprite + "\t\t" + SSprite+  fix.format(HP_Sprite)
                                          + "\n4\t\t" + "Coke" + "\t\t" + Coke + "\t\t" + SCoke+  fix.format(HP_Coke)
                                          + "\n5\t\t" + "Royal" + "\t\t" + Royal + "\t\t" + SRoyal+  fix.format(HP_Royal)
                                         );

             JOptionPane.showMessageDialog(null, ViewManager);







    }//start
}//main

my errors were this:
error:cannot find symbol line 142
error:cannot find symbol line 152

the ViewManager variable is defined on line 45, inide the do block that starts at line 41, so it goes out of scope when that do block is closed, and cannot be used after that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.