Drop hier links of afbeeldingen om ze aan de editor toe te voegen.

Calculate the magnification of a microscope.

★★☆

It's not clear who invented the first microscope, but the Dutch spectacle maker Zacharias Janssen (b. 1585) is credited with making one of the earliest compound microscopes (ones that used two lenses) around 1600. Today's electron microscopes allow us to see individual atoms.

Microscopy

Make

Write a program that calculates the magnification of an image from the actual size of a specimen in micrometers, and the output image size in centimeters.

Success Criteria

Remember to add a comment before a subprogram or selection statement to explain its purpose.

Complete the subprogram called magnification so that:

  1. It returns the magnification. This is calculated as (image size * 10000) / actual size.

Complete the main program so that:

  1. The user can input the actual size in micrometers.
  2. The user can input the image size in centimeters.
  3. Both inputs are integers.
  4. mag should equal the value returned from the magnification subprogram.

Typical inputs and outputs from the program would be:

Enter the actual size in micrometers:
80
Enter the image size in centimeters:
10
The magnification is 1250.0 X
🆘 If you're really stuck, use this Parsons code sorting exercise
Complete program
// Microscopy program

using System;

class Submission
{
---
    // -------------------------
    // Subprograms
    // -------------------------
    // Calculate the magnification
    static double magnification(int actual_size, int image_size)
    {
---
        double image_size_mm = image_size * 10000;
---
        return image_size_mm / actual_size;
---
    }
---

    // -------------------------
    // Main program
    // -------------------------
    public static void Main(string[] args)
    {
---
        Console.WriteLine("Enter the actual size in micrometers:");
        int actual_size = Convert.ToInt32(Console.ReadLine());
---
        Console.WriteLine("Enter the image size in centimeters:");
        int image_size = Convert.ToInt32(Console.ReadLine());
---
        double mag = magnification(actual_size, image_size);
---
        Console.WriteLine("The magnification is " + mag + " X");
---
    }
---
}