What are the Global and Local variables for the program below? Do a structured w
ID: 3730101 • Letter: W
Question
What are the Global and Local variables for the program below? Do a structured walkthrough, show your work.
public class MthdHomework
{
static int a,b,c,d;
public static void main(String[] args)
throws FileNotFoundException
{
int m,n,c,k;
m=5; n=3; b=4; a=2; c=5; d=3; k=7;
k=one(m,a);
c=two(n,k,b);
System.out.printf("%d %d %d %d ",m,n,c,k);
prnt();
}
public static int one(int a, int y)
{
int b,w;
w=d-a+y;
c=a-y;
b=y*4-w;
System.out.printf("one function ");
return(b);
}
public static int two(int c,int d, int e)
{
System.out.printf("two function ");
return(c/d+a-e/d);
}
public static void prnt()
{
System.out.printf("prnt function ");
System.out.printf("%d %d %d %d ",a,b,c,d);
}
}
Method
Local Variables
Global Variables
main
one
two
prnt
Method
Local Variables
Global Variables
main
one
two
prnt
Explanation / Answer
Method Local Variables Global Variables main m,n,c,k a,b,c,d one b,w a,b,c,d,y two a,b,c,d,e prnt a,b,c,d
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.