Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

c# help with these methods for Windows Form... public void SetAngle(float angle)

ID: 3604913 • Letter: C

Question

c# help with these methods for Windows Form...

public void SetAngle(float angle){

//This method alters the value of the UpDownNumeric used to control the angle, setting it to the provided value.

}

public void SetTankPower(int power){

//This method alters the value of the TrackBar used to control the power level, setting it to the provided value.

}

public void SetWeaponIndex(int weapon){

//This method changes the selected item in the ComboBox, setting it to the provided value.

}

public void Fire(){

/*This method is called both externally (by the computer player when it wants to fire) and by the 'Fire!' button when it is clicked. It does the following:

-Calls currentGame's GetPlayerTank() method to get a reference to the current player's ControlledTank, then calls its Fire() method.

-Disables the control panel

-Enables the Timer*/

}

Explanation / Answer

Solution==========================

public void SetAngle(float angle)
        {

            //This method alters the value of the
            //UpDownNumeric used to control the angle, setting it to the provided value.
            numericUpDown1.Value = (int)angle;
        }

        public void SetTankPower(int power)
        {

            //This method alters the value of the TrackBar
            //used to control the power level, setting it to the provided value.
            trackBar1.Value = power;

        }

        //Assuming index starts with 0
        public void SetWeaponIndex(int weapon)
        {

            //This method changes the selected item in the ComboBox,
            //setting it to the provided value.
            comboBox1.SelectedIndex = weapon;
        }

        //This last part requires knowledge of your whole program
        //Providing this roughly, of what it could be
        public void Fire()
        {

            /*This method is called both externally (by the computer player when it wants to fire) and by the 'Fire!' button when it is clicked. It does the following:

            -Calls currentGame's GetPlayerTank() method to get a reference to the current player's ControlledTank, then calls its Fire() method.

            -Disables the control panel

            -Enables the Timer*/

            ControlledTank tank = GetPlayerTank();
            tank.Fire();
            tank.disableControlPanel();
            Timer timer = new Timer();
            timer.Enabled = true;

        }

The last method did had a lot of ambiguity, since its only a part of a whole program(which is unknown to me)

Let me know if any issues...

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote