This lab is an exercise of using Java’s and C++’s dynamic binding features. The uncompleted programs to run in Java and in C++ are given below. Note that you need to create a driver class with the main method to run the Java program. Also, you need to write the main function to run the C++ program. Perform the following activities:predict the output of the Java program.run the Java program and compare your prediction to the actual output of the program. Complete the C++ program such that it prints the same output as the Java program does. You need to use the given classes to generate the desired output.The purpose of this lab is to exercise the dynamic binding features in Java and C++. Therefore, you need to make sure your Java and C++ programs perform the same dynamic binding and give the same output. Without dynamic binding, simply making the program print out the desired output will not accrue any credits. The Java Program is: class A{ public void p() { System.out.println(“A.p”); } public void q() { System.out.println(“A.q”); } public void r() { p(); q(); }} class B extends A{ public void p() { System.out.println(“B.p”); }} class C extends B{ public void q() { System.out.println(“C.q”); } public void r() { p(); q(); }}…A a;C c = new C();a = c;a.r();a = new B();a.r();a = new C();a.r(); The C++ Program is: class A{ public:virtual void p() { cout << “A.p” << endl; } void q() { cout << “A.q” << endl; } virtual void r() { p(); q(); }}; class B : public A{ public:void p() { cout << “B.p” << endl; }}; class C : public B{ public:void q() { cout << “C.q” << endl; } void r() { p(); q(); }};

![Java, Please help with my code, Need my draw lines to be exact like in pictureimport java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.JOptionPane; public class Homework2 extends Frame implements ActionListener { String command = ""; public static void main(String[] args) { Frame frame = new Homework2(); frame.setResizable(true); frame.setSize(900,800); frame.setVisible(true); } public Homework2() { setTitle("Homework2 - CSC 229 - Seyed"); // Create Menu MenuBar mb = new MenuBar(); setMenuBar(mb); Menu fileMenu = new Menu("File"); mb.add(fileMenu); MenuItem miAbout = new MenuItem("About"); miAbout.addActionListener(this); fileMenu.add(miAbout); MenuItem miExit = new MenuItem("Exit"); miExit.addActionListener(this); fileMenu.add(miExit); Menu actionMenu = new Menu("Shapes"); mb.add(actionMenu); MenuItem miP1 = new MenuItem("Problem 1"); miP1.addActionListener(this); actionMenu.add(miP1); MenuItem miP2 = new MenuItem("Problem 2"); miP2.addActionListener(this); actionMenu.add(miP2); // End program when window is closed WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent ev) { System.exit(0); } public void windowActivated(WindowEvent ev) { repaint(); } public void windowStateChanged(WindowEvent ev) { repaint(); } }; ComponentListener k = new ComponentAdapter() { public void componentResized(ComponentEvent e) { repaint(); } }; // register listeners this.addWindowListener(l); this.addComponentListener(k); } //****************************************************************************** // called by windows manager whenever the application window performs an action // (select a menu item, close, resize, .... //****************************************************************************** public void actionPerformed (ActionEvent ev) { // figure out which command was issued command = ev.getActionCommand(); // take action accordingly switch(command) { case "About": { repaint(); break; } case "Exit": { System.exit(0); } case "Problem 1": { repaint(); break; } case "Problem 2": { repaint(); break; } } } //******************************************************** // called by repaint() to redraw the screen //******************************************************** public void paint(Graphics g) { int ww = (int) this.getWidth(); // current width of the window int wh = (int) this.getHeight(); // current height of the window int s = 40; // Check Command issued, take action accordingly switch(command) { case "About": { break; } case "Exit": { System.exit(0); } case "Problem 1": { break; } case "Problem 2": { break; } } } }](https://gotit-pro.com/wp-content/uploads/2023/10/878eb3bb-2c74-4ae8-b357-40cb301279d6-300x331.png)
This lab is an exercise of using Javas and Cs dynamic binding features The uncompleted programs
Original price was: $10.00.$5.00Current price is: $5.00.
-50%Download button will appear immediately after successful payment.
Full support will be provided with necessary files installation.
Get impeccable customized solution within 24 hours, hassle-free.
Paul Benson –
Fantastic support for every assignment, every time. 5+ Stars!
Jorge Rivas –
Great Work In Timely Fashion. Something what I wanted.