1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
levacccp [35]
4 years ago
12

A program that accepts insurance policy data, including a policy number, customer last name, customer first name, age, premium d

ue date (month, day, and year), and number of driver accidents in the last three years. If an entered policy number is not between 1000 and 9999 inclusive, set the policy number to 0. If the month is not between 1 and 12 inclusive, or the day is not correct for the month (for example, not between 1 and 31 for January or 1 and 29 for February), set the month, day, and year to 0. Display the policy data after any revisions have been made.
Computers and Technology
1 answer:
valentina_108 [34]4 years ago
8 0

Answer:

  1. policy_num = int(input("Enter policy number: "))
  2. lastName = input("Enter last name: ")
  3. firstName = input("Enter first name: ")
  4. premiumDate = input("Enter premius due date (mm/dd/yyyy): ")  
  5. numAcc = int(input("Enter number of driver accident in the past three years: "))
  6. if(policy_num <1000 or policy_num > 9999):
  7.    policy_num = 0  
  8. dateComp = premiumDate.split("/")
  9. month = int(dateComp[0])
  10. day = int(dateComp[1])
  11. year = int(dateComp[2])
  12. if(month < 1 or month > 12):
  13.    month = 0
  14.    day = 0
  15.    year = 0  
  16. else:
  17.    if(month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12):
  18.        if(day < 1 or day > 31):
  19.            month = 0
  20.            day = 0
  21.            year = 0  
  22.    elif(month == 4 or month == 6 or month == 9 or month == 11):
  23.        if(day <1 or day > 30):
  24.            month = 0
  25.            day = 0
  26.            year = 0
  27.    elif(month == 2):
  28.        if(day < 1 or day > 29):
  29.            month = 0
  30.            day = 0
  31.            year = 0
  32. print("Policy number: " + str(policy_num))
  33. print("Last name: " + lastName)
  34. print("First name: " + firstName)
  35. print("Premium Date: " + str(month) + "/" + str(day) + "/" + str(year))
  36. print("Number of driver accidentin the last three years: " + str(numAcc))

Explanation:

The solution code is written in Python 3.

Firstly use input function to prompt user to enter all the necessary insurance policy data (Line 1 - 5).

Next create an if statement to validate the input policy number. If the policy number is not within the range of 1000 - 9999, set the policy number to zero (Line 7 -8).

Next, split the input premium date into month, day and year (Line 10 -13). It is followed by checking the month if it is between 1 - 12. If not, set the month, day and year to zero (Line 15 - 18). Otherwise the program will proceed to validate the month based on the maximum and minimum number of days for a particular month (Line 20 - 34). If the day is out of range, set month, day and year to zero.

Lastly, use print function to display the policy data (Line 36 - 40).

You might be interested in
What does the R in the acronym SMART stand for??
jeyben [28]
Depending on who you ask, it is either Realistic or Relevant. Organizations that can't choose sometimes use the acronym SMARRT.
7 0
4 years ago
Compare the two types of formatting that IDE devices must go through. What is the primary difference between the two?
Andrei [34K]
A quick format<span> changes the file system while the </span>full format<span> also checks the </span>drive for bad sectors.  <span>The scan for bad sectors is the reason why the Full </span>format<span> takes twice as long as the </span>Quick format<span>. If you choose the </span>Quick format<span> option, the </span>format<span> removes address files from the partition, but does not scan the disk for bad sectors.</span>
7 0
3 years ago
Read 2 more answers
Create a class called MyBoxes with: - 1 instance variable, and array to hold Box objects - a constructor with 1 parameter - the
Veseljchak [2.6K]

Answer:

C++

Explanation:

class MyBoxes {

   private:

       // Pointer to Box object and array size. Required for dynamically creating an array.

       Box* boxes;

       int array_size;

       // Constructor

       MyBoxes(int array_size) {

           self.array_size = array_size;

           boxes = new Box[array_size] ;

       }

   public:

       // Methods

       int emptyspace() {

           int count = 0;

           for (int i=0; i < self.array_size; i++) {

               // Check for null

               if (!boxes[i])

                   count++;

           }

           return count;

       }

       void add(int length, int width, int height) {

           Box box1(length, width, height);

           if (self.emptyspace() == 0)  {

               self.addToArray(box1);

           }

       }

       void print() {

           Box *temporaryBox;

           for (int i=0; i < self.array_size; i++) {

               temporaryBox = boxes[i];

               if (temporaryBox) {

                   cout<<temporaryBox->length<<endl;

                   cout<<temporaryBox->width<<endl;

                   cout<<temporaryBox->height<<endl;

               }

           }

           // Free memory

           delete temporaryBox;  

       }

4 0
4 years ago
Part B - Find the solutions for the following Case Study Real World Problems by applying the appropriate concepts that you learn
Monica [59]

Answer:

ok very surprised to hear that

5 0
3 years ago
Desktop Management software requires managers to install software such as antivirus updates or application updates on client com
Natali [406]

Answer: False

Explanation: Desktop management is the managing of the computer system and its elements .They also supervises the data organization , network management, etc.

The desktop management software requires automatic installation rather than being installed by the managers.The updates for the antivirus or application occurs after a certain period of time intervals automatically because of the inbuilt feature of the software . So, the given statement is false.

5 0
4 years ago
Other questions:
  • Fluyen en tecnologia
    15·1 answer
  • List any four routes of transmission of computer virus. <br>please give me answer​
    8·1 answer
  • Which Windows feature captures and stores copies of folders and files at specific points in time, allowing users or administrato
    10·1 answer
  • Rather than simply repeating key terms and concepts, Jeremy focused on the meaning of the information in the chapter and tried t
    13·1 answer
  • Compare and contrast the uses of NetWitness Investigator and Wireshark used in the lab. Why would a network administrator use Wi
    8·1 answer
  • What's ur favorite color and your dream car
    8·2 answers
  • Who requests services and who facilitates services to a client.​
    6·1 answer
  • Need help coding this it uses input and I need to use the words good and morning
    10·1 answer
  • What would be printed to the screen when the following program is run?
    11·1 answer
  • an engineer is writing a web application that requires some user input. the engineer has put a submit button on their page and n
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!