First off no idea why the title doesn't say the full title, but My problem is getting snum in the main class to transfer over to the sub class, so that the snum in that class = snum from the main class
The code is;

package workstation; 
import java.util.Random; 
import javax.swing.*; 

public class Main 
{ public static void main(String[] args) { 
int swip,ewip,number; 
final int snum1; 
swip = 1000; //Starting work in progress 
number =0; //Given it a default value otherwise errors occur Random dice = new Random(); 

for(int counter=0; counter<1;counter++)
{ number =1+dice.nextInt(6); } //end counter/number 

System.out.println("RM Dice number= "+number);//Check ewip=swip - number; //End WIP = Start WIP - random number 

[U]snum1[/U]=number; //Send number =random number 

System.out.println("End WIP="+ewip); //Check 

System.out.println("Sent number= "+snum1); //Check class 

raw_material extends Main{ 
int swip,snum,ewip,number; 
{ 
swip= 4; 
Random dice = new Random(); 
for(int counter=0; counter<1;counter++)
{ number =1+dice.nextInt(6); //Creates the random number of counters to pass 

System.out.println("WS1 dice roll "+number); 
snum = number;//send counters = dice roll 
ewip =swip-number+[U]snum1[/U]; // End work in progress is calculated System.out.println("Snum1 "+snum1); } } } } }

Edited 6 Years Ago by ~s.o.s~: Fixed code tags

First of all: Sorry, but your indentation (or lack thereof) is hideous. Please try to make your code a bit more presentable. (don't take this as an insult, it will really help you out in the longterm and others trying to help you too).

Maybe it's just me and my tiredness talking but I'm not seeing any instance of the subclass raw_material.

Edited 6 Years Ago by Crushyerbones: n/a

This article has been dead for over six months. Start a new discussion instead.