Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1- Nested selection statements (if/else -switch) The Quebec government is trying to crack down on texting and driving. The law is very clear: you
Question 1- Nested selection statements (if/else -switch) The Quebec government is trying to crack down on texting and driving. "The law is very clear: you must not hold a cell phone in your hand while driving. Failure to abide by this rule is an offence subject to a fine and demerit points." ghttps://saaq.gouv.qc.ca/en/road-safety/behaviours/distractions/cell-phones-texting/what-the-law-says) Write a program that determines the penalty for a driver holding a cell phone while driving based on Nancy's Crazy criteria. If the driver is driving and holding a cell phone On the highway the fine is $80. If it is the drivers 1st offence s/he gets 1 demerit point otherwise 2 demerit points. In a school zone the fine is $100 (the maximum). If the driver has been driving for less than 24 months s/he loose his/her license on the spot otherwise s/he get 4 demerit points (the maximum]) If the car is stopped, for example at a stop sign or a traffic light, and the cellphone is an iPhone, the fine is $100 and s/he gets 2 demerit point otherwise the fine is $80 and s/he gets 1 demerit points. (Crazy Nancy does not like iPhones.) All other cases the fine is $90 and the driver gets 3 demerit points. After determining where the driver was stopped and what their fine if they have not yet lost their license, ask the user how many demerit points the driver originally had. When a driver has 12 demerit points they lose their license. Determine if the driver should lose their license given where they were when they were holding their cell phone. Output how many demerit points the driver now has. Assume you have a perfect user who enters valid input. The following are recommended statements for solving this problems: switch, if/else and nested if/else. Here are a few sample outputs to illustrate the expected behavior of your program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started