java - class X extends Y. Symbols won't transfer -


i've searched through quite few questions relating this, i'm not sure problem is. when run lab4b_info, variables m1 , m2 being identified location; however, information m1 , m2 come sister program lab4a_receipt. result, i'm receiving error program cannot find symbol.

to put bit more simply, need coins , dollars information @ bottom of 4a, extend 4b. here 2 programs in question.

import javax.swing.*; import javax.swing.joptionpane;  class lab4a_receipt {     public static void receipt() {         string c1, c2, c3, p, s, d, pay;          double r1, r2, r3, pc = 0, sc = 0, dc = 0, ment, total;          c1 = joptionpane.showinputdialog("would pizza? yes (1) or no(2)?");         r1 = integer.parseint(c1);          if (r1 != 1) {             pc = 0;         } else if (r1 == 1) {             p = joptionpane.showinputdialog("excellent! kind? pepperoni (1) $10? cheese (2) $8? (3) $12!?");             pc = integer.parseint(p);         }         if (pc == 1) {             pc = 10;         } else if (pc == 2) {             pc = 8;         } else if (pc == 3) {             pc = 12;         }         ///          c2 = joptionpane.showinputdialog("would sandwhich? yes (1) or no(2)?");         r2 = integer.parseint(c2);         if (r2 != 1) {             sc = 0;         } else if (r2 == 1) {             s = joptionpane.showinputdialog("okee doke. stromboli (1) $7, or ham , cheese (2) $6?");             sc = integer.parseint(s);         }         if (sc == 1) {             sc = 7;         } else if (sc == 2) {             sc = 6;         }          ///          c3 = joptionpane.showinputdialog("how drink? yes (1) or no(2)?");         r3 = integer.parseint(c3);         if (r3 != 1) {             dc = 0;         } else if (r3 == 1) {             d = joptionpane.showinputdialog("okay then. coke (1), pepsi (2), or doctor peper (3)? $1.");             dc = integer.parseint(d);         }         if (dc == 1) {             dc = 1;         } else if (dc == 2) {             dc = 1;         } else if (dc == 3) {             dc = 1;         }         ///          total = pc + sc + dc;         double tax = (total * 1.06);         double round = math.round(tax * 100.0) / 100.0;         system.out.println("pizza: $" + pc + " sandwhich: $" + sc + " drink: $" + dc + " total: $" + round + "");          string output = "order\tcost";          output += "\n" + "pizza" + "\t" + pc;         output += "\n" + "sandwhich" + "\t" + sc;         output += "\n" + "drink" + "\t" + dc;         output += "\n" + "total" + "\t" + total;           jtextarea outputarea = new jtextarea();         outputarea.settext(output);          joptionpane.showmessagedialog(null, outputarea, "receipt", joptionpane.information_message);         pay = joptionpane.showinputdialog("what pay with?");         ment = integer.parseint(pay);         system.out.println("you've decided pay $" + ment + "");          //////////////////dollars         double dol = math.floor(ment - round);          int m1 = (int) dol;          /////////////////////coin         double cha = math.round((ment - round) * 100.0) / 100.0;         double = math.floor(((dol - cha) * 100) * -1);         int m2 = (int) a;      } } 

and here's second part.

class lab4b_info extends lab4a_receipt {     public static void main(string[] args) {          int x = m1;         int y = m2;          system.out.println("change:");          int d1 = x / 50;         if (d1 > 0) {             x = x % 50;             system.out.println(d1 + " 50 dollar bill(s)");         }         int d2 = x / 20;         if (d2 > 0) {             x = x % 20;             system.out.println(d2 + " 20 dollar bill(s)");         }         int d3 = x / 10;         if (d3 > 0) {             x = x % 10;             system.out.println(d3 + " 10 dollar bill(s)");         }         int d4 = x / 5;         if (d4 > 0) {             x = x % 5;             system.out.println(d4 + " 5 dollar bill(s)");         }         int d5 = x;         if (d5 > 0) {             system.out.println(d5 + " 1 dollar bill(s)");         }          int q = y / 25;         if (q > 0) {             y = y % 25;             system.out.println(q + " quarter(s)");         }         int d = y / 10;         if (d > 0) {             y = y % 10;             system.out.println(d + " dime(s)");         }         int n = y / 5;         if (n > 0) {             y = y % 5;             system.out.println(n + " nickle(s)");         }         int p = y;         if (p > 0) {             system.out.println(p + " penny(s)");         }     } } 

it's may small detail i've overlooked, programming sound. when put together, runs fine.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -