Question

Use C# coding to solve this problem

Consider the situation of issuing parking tickets on campus and determining the fines associated with the ticket.

There is a 15 miles per hour (MPH) speed limit on streets on campus. All students are charged an initial $75.00 when ticketed. Additional charges are based on how much over the speed limit the ticket reads. After the initial $75 fee, an extra $87.50 is charged for every 5 MPH students are clocked over the speed limit. The traffic office feels seniors have been around for a while and should know better than to speed on campus. They add even more fees to their fine. At the same time, they try to cut freshman a little slack.

•Seniors are charged an extra $50 if they are traveling less than 20 MPH. Seniors are charged an extra $200 otherwise.

•If freshman are exceeding the speed limit less than 20 MPH, they get a $50 deduction off their fines. However, freshmen, sophomores, and juniors traveling 20 MPH or more are fined an additional $100.

Use this flow document to develop your Bool code blocks

Use the sample output page as an example for the console output

ps. You can use 8 string numbers for student#

Example 4 (continued) Sample output Ticket App Student number: XXXXXXX Classification: XXXXXXXXX Speed limit: xx Reported speExample 4 (continued) Formula: fine = (speed-speedlimit / 5)*extraRate + 75.00 Flow Chart for the extra Rate calculation true

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

Hi,

Please find the code below according to the given formula, also output attached.

using System;
namespace SpeedingFine
{
class Program
{
static void Main(string[] args)
{
int reportedSpeed;
float fine=0.0f;
float finalFine;
string s1="senior";
string s2="Freshman";
  
string studentNumber;
Console.WriteLine("Enter Student Number");
studentNumber = Console.ReadLine();
Console.WriteLine("Student Number: '{0}'", studentNumber);
  
int speedLimit = 15;
Console.WriteLine("Speed Limit:'{0}'",speedLimit);
  
Console.WriteLine("Enter reported speed");
reportedSpeed = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Reported Speed '{0}'", reportedSpeed);
  
string classification;
           Console.Write("Enter classification of student - ");
           classification = Console.ReadLine();
           Console.WriteLine("Classification '{0}'", classification);
          
           //if the classification is senior
           if(s1 == classification)
           {
           if(reportedSpeed>=20)
           fine=fine+200;
           else
           fine=fine+50;
           }
           else
           {
           //if the classification if Freshman
           if(s2 == classification)
           {
           if(reportedSpeed>=20)
           fine=fine+100;
           else
           fine=fine-50;
           }
           else
           {
           if(reportedSpeed>=20)
           fine=fine+100;
           else
           fine=fine-0;
           }
           }
           Console.WriteLine("Extra Fine calculated is {0}", fine);

   finalFine = (reportedSpeed-speedLimit/5)*fine+75; // this is according to the formula given in question.

Console.WriteLine("Final Fine calculated is {0}", finalFine);
}
}
}

Thanks,

kindly upvote
output:

Enter Student Number 12345 Student Number: 12345 Speed Limit:15 Enter reported speed 35 Reported Speed 35 Enter classifi

Enter Student Number 123456 Student Number: 123456 Speed Limit:15 Enter reported speed 35 Reported Speed 35 Enter classif

Add a comment
Answer #2

using System;

using System.Collections;



namespace Assignment_2

{

    class Program

    {

        int speedlimit;

       int speed;

       char classification;

       string s1 ="seniour";

       string f1="freshmen";


       

        float fine;

       

        static void Main(string[] args)

        {

       

       

          string studentNumber;

            Console.Write("Enter the student number");

            Console.Write("enter the speed");

           

         

            Console .WriteLine("enter the reportrd speed");

           

           

            Console.WriteLine("enter classification of student");


           

           Console.WriteLine("the speed is");

                   


       

       

           


         

            if(s1)

            {

             

                if(speed > 20)

                    fine= fine + 200;

             else

                     fine= fine + 50;

            }


            else

                if(f1)

                {

                 

                    if(speed < 20)

                     fine= fine - 50;

                   else

                          fine= fine + 100;

                }

                    else

                    if(speed >=20)

                    fine = fine + 100;




                 

       

               


           

        }

    }

}


answered by: Nikhil Bhingradiya
Add a comment
Know the answer?
Add Answer to:
Use C# coding to solve this problem Consider the situation of issuing parking tickets on campus...
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
  • just the extra credit part please Your customer needs an automated system to patrol the highways....

    just the extra credit part please Your customer needs an automated system to patrol the highways. The job of the system is to collect the following information on vehicles traveling down a certain stretch of highway: license plate number, current speed, and speed limit. A program is required to determine if a speeding ticket is needed for each set of data. Ticket will only be issued when number of miles per hours (mph) over the speed limit is at least...

  • This is a c++ program. Use the description from Parking Ticket Simulator (listed below) as a basis, where you need to...

    This is a c++ program. Use the description from Parking Ticket Simulator (listed below) as a basis, where you need to create a Car class and Police Officer class, to create a new simulation. Write a simulation program (refer to the Bank Teller example listed below) that simulates cars entering a parking lot, paying for parking, and leaving the parking lot. The officer will randomly appear to survey the cars in the lot to ensure that no cars are parked...

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