The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 327 Weeks Ago, 6 Days Ago |
| Questions Answered: | 12843 |
| Tutorials Posted: | 12834 |
MBA, Ph.D in Management
Harvard university
Feb-1997 - Aug-2003
Professor
Strayer University
Jan-2007 - Present
I have attached the homework that I need help on. Thanks in advance!!!
Â
Homework 1InstructionsFor problems 1 through 4, explain why the code as shown is almost certainly not what theprogrammer intended, and how it should be fixed to work the way the programmer probably hadin mind.1. (10 pts) What is wrong with the following program and how should it be fixed?1  public class MyClassA {2    int v = 12;3 4    public MyClassA (int pV) {5      v = pV;6    } 7 8    public static void main (String args []) {9      MyClassA m = new MyClassA ();10   } // end main11 } // end class MyClassA2. (10 pts) What is wrong with the following program and how should it be fixed?1  public class MyClassB {2    int v = 12;3 4    public void MyClassB (int pV) {5      v = pV;6    } 7 8    public static void main (String args []) {9      MyClassB m = new MyClassB (23);10   } // end main11 } // end class MyClassB3. (10 pts) What is wrong with the following program and how should it be fixed?1   public class MyClassD {2     public static void main (String args []) {3       MyClassC m = new MyClassC (23);4     } // end main
Attachments:
-----------