Question

VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE & ANSWER/FOLLOW ALL THE QUESTIONS IN THE ASSIGNMENT! Planet Info Help When planning this project, review the concept of accessing object properties on another form. Form2.IblMess

X Astronomy Helper Planets Fle NAS MERCURY VENUS EARTH MARS JUPITER SATURN URANUS NEPTUNE PLUTO frmPlanet Information Type: T

Earth Type Terrestrial Average distance from the sun 1 AU Mass 5.967_1024 kg Surface temperature_50°C to 50°C Mars Type Terre

Saturn Type Jovian Average distance from the sun 9.5388 AU Mass 5.69_1026 kg Temperature at cloud tops_180°C Uranus Type Jovi

Neptune Type Jovian Average distance from the sun 30.0611 AU Mass 1.03_1026 kg Temperature at cloud tops _216°C Pluto Type Lo

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Create a Form1 and add the menuStrip from Tollbox. Create a File and Planet menu

In a File menu:

Type Here Astronomy Helper File Planets Exit Type Here MAR MER

In a Planet menu:

Astronomy Helper File Planets Type Here SUN Earth Mars Jupiter Saturn Uranus Neptune Pluto Type Here

create each of the menu strip click event to perform the action for the menu.

add a picbox to display the planet in the picbox

SUN File Planets - Astronomy Helper MERCURI VENU EARTI MAR JUPITEL SATURN URANU NEPTUN PLUTO

Now create a another form Form2

add groupbox and in the group box add the label and picbox to display the planet details and the picture of the planet.

frm Planet x Information IblPlanetName Type: IbType- Average Distance from Sun: IbIDistance These are the label name to displ

code of the Form1:

using System;
using System.Windows.Forms;

namespace Astronomy_Helper
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
            this.IsMdiContainer = true;
        }
        //exit menu strip event
        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit(); //exit the application
        }

        //earth menu strip event
        private void earthToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null) //check for the mdi child form is open/active'
                ActiveMdiChild.Close(); //close the child form
            //create a form object and pass the name to the planet to the form
            Form2 frm = new Form2("earth");
            frm.Hide();
            frm.MdiParent = this;
            frm.Show(); //show the form
        }
        //mars menu strip event
        private void marsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null) //check for the mdi child form is open/active'
                ActiveMdiChild.Close(); //close the child form
            //create a form object and pass the name to the planet to the form
            Form2 frm = new Form2("mars");
            frm.Hide();
            frm.MdiParent = this;
            frm.Show(); //show the form
        }
        //jupiter menu strip event
        private void jupiterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null) //check for the mdi child form is open/active'
                ActiveMdiChild.Close(); //close the child form
            //create a form object and pass the name to the planet to the form
            Form2 frm = new Form2("jupiter");
            frm.Hide();
            frm.MdiParent = this;
            frm.Show(); //show the form
        }
        //saturn menu strip event
        private void saturnToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null) //check for the mdi child form is open/active'
                ActiveMdiChild.Close(); //close the child form
            //create a form object and pass the name to the planet to the form
            Form2 frm = new Form2("saturn");
            frm.Hide();
            frm.MdiParent = this;
            frm.Show(); //show the form
        }
        //uranus menu strip event
        private void uranusToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null) //check for the mdi child form is open/active'
                ActiveMdiChild.Close(); //close the child form
            //create a form object and pass the name to the planet to the form
            Form2 frm = new Form2("uranus");
            frm.Hide();
            frm.MdiParent = this;
            frm.Show(); //show the form
        }
        //neptune menu strip event
        private void neptuneToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null) //check for the mdi child form is open/active'
                ActiveMdiChild.Close(); //close the child form
            //create a form object and pass the name to the planet to the form
            Form2 frm = new Form2("neptune");
            frm.Hide();
            frm.MdiParent = this;
            frm.Show(); //show the form
        }
        //pluto menu strip event
        private void plutoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null) //check for the mdi child form is open/active'
                ActiveMdiChild.Close(); //close the child form
            //create a form object and pass the name to the planet to the form
            Form2 frm = new Form2("pluto");
            frm.Hide();
            frm.MdiParent = this;
            frm.Show(); //show the form
        }
    }
}

code for Form2:

using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;

namespace Astronomy_Helper
{
    public partial class Form2 : Form
    {

        public Form2(string planetName)
        {
            //check for the each planet and set the variable object value
            if(planetName == "earth")
            {
                InitializeComponent();
                lblPlanetName.Text = "Earth";
                lblType.Text = "Terrestrial";
                lblDistance.Text = "1AU";
                lblMass.Text = "5.967X10E24 Kg";
                lblTemperature.Text = "-50°C to 20° C";
                var imgpath = Path.GetDirectoryName(Application.ExecutablePath) + "\\" + "earth.jpg";
                pictureBox1.Image = Image.FromFile(imgpath);
            }
            else if (planetName == "mars")
            {
                InitializeComponent();
                lblPlanetName.Text = "Mars";
                lblType.Text = "Terrestrial";
                lblDistance.Text = "1.5237 AU";
                lblMass.Text = "0.6264X10E24 Kg";
                lblTemperature.Text = "-140°C to 20° C";
                var imgpath = Path.GetDirectoryName(Application.ExecutablePath) + "\\" + "mars.jpg";
                pictureBox1.Image = Image.FromFile(imgpath);
            }
            else if (planetName == "jupiter")
            {
                InitializeComponent();
                lblPlanetName.Text = "Jupiter";
                lblType.Text = "Jovian";
                lblDistance.Text = "5.2028 AU";
                lblMass.Text = "1.899X10E27 Kg";
                lblSurfaceInfo.Text = "Temperature at cloud tops: ";
                lblTemperature.Text = "-110°C";
                //show the planet image
                var imgpath = Path.GetDirectoryName(Application.ExecutablePath) + "\\" + "jupiter.jpg";
                pictureBox1.Image = Image.FromFile(imgpath);
            }
            else if (planetName == "saturn")
            {
                InitializeComponent();
                lblPlanetName.Text = "Saturn";
                lblType.Text = "Jovian";
                lblDistance.Text = "9.5388 AU";
                lblMass.Text = "5.697X10E26 Kg";
                lblSurfaceInfo.Text = "Temperature at cloud tops: ";
                lblTemperature.Text = "-180°C";

                //show the planet image
                var imgpath = Path.GetDirectoryName(Application.ExecutablePath) + "\\" + "saturn.jpg";
                pictureBox1.Image = Image.FromFile(imgpath);
            }
            else if (planetName == "uranus")
            {
                InitializeComponent();
                lblPlanetName.Text = "Uranus";
                lblType.Text = "Jovian";
                lblDistance.Text = "19.18 AU";
                lblMass.Text = "8.69X10E25 Kg";
                lblSurfaceInfo.Text = "Temperature above cloud tops: ";
                lblTemperature.Text = "--220°C";

                //show the planet image
                var imgpath = Path.GetDirectoryName(Application.ExecutablePath) + "\\" + "uranus.jpg";
                pictureBox1.Image = Image.FromFile(imgpath);
            }
            else if (planetName == "neptune")
            {
                InitializeComponent();
                lblPlanetName.Text = "Neptune";
                lblType.Text = "Jovian";
                lblDistance.Text = "30.0611 AU";
                lblMass.Text = "1.03X10E26 Kg";
                lblSurfaceInfo.Text = "Temperature at cloud tops: ";
                lblTemperature.Text = "-216°C";

                //show the planet image
                var imgpath = Path.GetDirectoryName(Application.ExecutablePath) + "\\" + "neptune.jpg";
                pictureBox1.Image = Image.FromFile(imgpath);
            }
            else if (planetName == "pluto")
            {
                InitializeComponent();
                //set the value to the variable
                lblPlanetName.Text = "Pluto";
                lblType.Text = "Low Density";
                lblDistance.Text = "39.44 AU";
                lblMass.Text = "1.22X10E22 Kg";
                lblTemperature.Text = "-230° C";

                //show the planet image
                var imgpath = Path.GetDirectoryName(Application.ExecutablePath) + "\\" + "pluto.jpg";
                pictureBox1.Image = Image.FromFile(imgpath);
            }

        }

        private void Form2_Load(object sender, EventArgs e)
        {
            //disable the maximize and minimize button
            this.MaximizeBox = false;
            this.MinimizeBox = false;
        }
    }
}

sample output:

SUN File Planets Astronomy Helper EARTH MARS JUPITER SATURN URANUS NEPTUNE PLUTO х

X Astronomy Helper File Planets SUN US E RN US NE MERCURY PLUTO o frmPlanet х Information Mars Type: Terrestrial Average DistAstronomy Helper File Planets SUN 3 US NE MERCURY frmPlanet PLUTO x Information Saturn Type: Jovian Average Distance from Sun

Add a comment
Know the answer?
Add Answer to:
VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE &...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can someone help me with this question, I do not know how to do the long-distance...

    Can someone help me with this question, I do not know how to do the long-distance in excel. If you could show me the Excel data as well that would be great. retention 10.18 The following are the average distances of the planets in the solar system from the 25 Distance (millions of miles) 47.163 67.235 92.960 141.61 313.00 483.60 886.70 1783.0 2794.0 3666.0 Planet No. Planet Mercury Venus Earth Mars Asteroids Jupiter Saturn Uranus Neptune Pluto 4 10 (a)...

  • Please use the formulate sheet and show all steps to make sure the question is worth...

    Please use the formulate sheet and show all steps to make sure the question is worth any points a) The initial ratio of deuterium (D) to hydrogen (H) in a planet's atmosphere was 175000; however, the present ratio is 1/1500 and the initial and final abundances of D are 5 x 10° atoms per m3 and 9 x 106 atoms per m2, respectively. What fraction of deuterium has been lost, and what fraction of hydrogen has been lost in this...

  • Please explain step by step! Useful Planetary Data Mean Radius (m) 243 × 106 6.06 ×...

    Please explain step by step! Useful Planetary Data Mean Radius (m) 243 × 106 6.06 × 10° 6.38 × 10° 3.37 × 106 6.99×107 5.85 × 10' 2.33 × 107 221 × 107 1.14 × 10° 1.74 × 10° 696 × 108 Period (s) 7.60 × 106 1.94 × 107 3.156 × 10, 5.94 × 10' 3.74 × 108 9.35 × 108 2.64 × 109 5.22 × 109 782 × 109 Mean Distance from Sun (m) 579 × 100 1.08...

  • VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE &...

    VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE & ANSWER/FOLLOW ALL THE QUESTIONS IN THE ASSIGNMENT! . . Your program assignment Write a program name DeskGUI that computes the price of a desk and whose button Click Event calls the following methods: • A method to accept the number of drawers in the desk as input from the key board. This method returns the number of drawers to the SelectDesk_Click event. A method...

  • VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE &...

    VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE & ANSWER/FOLLOW ALL THE QUESTIONS IN THE ASSIGNMENT! . . Your program assignment Write a program name DeskGUI that computes the price of a desk and whose button Click Event calls the following methods: • A method to accept the number of drawers in the desk as input from the key board. This method returns the number of drawers to the SelectDesk_Click event. A method...

  • 6.4 Please help me answer & explain all parts! And please make sure handwriting is legible....

    6.4 Please help me answer & explain all parts! And please make sure handwriting is legible. Astronomical Data 4. Every planet (and moon) has its own acceleration due to gravity based on its mass and radius. Use the astronomical data in the back of the book for the following. A. What is the acceleration due to gravity on Venus? B. What is the acceleration due to gravity 'on' Uranus? (This is a gas giant so 'on' is relative.) Astronomical Data...

  • Using whatever means you wish (Excel, MatLab, IDL, python, abacus...) make up a spreadsheet of data...

    Using whatever means you wish (Excel, MatLab, IDL, python, abacus...) make up a spreadsheet of data for all 8 planets plus Pluto with the following information for each planet: Distance from Sun (in AU), Radius of the planet (in km), Mass of the planet (in 10^24 kg) and then calculate from these data (a) gravitational acceleration (m/s^2) at the surface (or 1 bar level for gas giants) of each planet; (b) escape speed (km/s) for each planet.

  • Astronomy helper Create an application that displays the following menu: select a planet 1. Mercury 2....

    Astronomy helper Create an application that displays the following menu: select a planet 1. Mercury 2. Venus 3. Earth 4. Mars 5. exit the program Enter your selection. When the user selects a planet from the menu, the program should display data about the planet's average distance from the sun, the planet's surface temperature. Use the following data in your program: Mercury Average distance from the sun ---------- 57.9 million kilometers Mass---------------3.31 x 10^23kg surface temperature------------ -173 to 430 degrees...

  • Page 3 of 6 10. Which of the following is correct? a) The rotation axes of...

    Page 3 of 6 10. Which of the following is correct? a) The rotation axes of planets are always perpendicular to their orbital plane (the ecliptic). b) No planet's orbital inclination is more than 20 degrees from the ecliptic. c) Planets orbits are circular. d) Planets always rotate and revolve in the same direction. 11. Which of the following is not a real difference between asteroids and comets? a) Asteroids are made mostly of rock and comets are made mostly...

  • The drilling technique known as ________ is causing much controversy in drilling oil shales. Panning Scrubbing...

    The drilling technique known as ________ is causing much controversy in drilling oil shales. Panning Scrubbing Fracking (hydraulic fracturing) Horizontal drilling Which of these elements may be the fuel of the future? Oxygen Hydrogen Helium Carbon Ohio has a lot of coal. What grade is it? Lignite Anthracite Bituminous Sub-bituminous In Ohio, the entrances to abandoned underground mines are cleaned and barred so _______ can live in them. Ground hogs Bats Raccons Moles As the solar system was forming, _________...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT