Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that allows the user to input a 5-digit nonnegative integer number between 10000 and 99999, separates that number into its individual digits

Write a program that allows the user to input a 5-digit nonnegative integer number between 10000 and 99999, separates that number into its individual digits and then prints the digits to the screen separated from one another by three spaces each.

If the number entered is not within the range of 10000 and 99999 (inclusive), output an error message that starts with a label of ERROR.

See sample output for examples.

We currently cant test input for being numeric or non-numeric, so assume that all input will be numeric.

Write a Perl program, thinking about the solution in terms of Perl's available functions instead of a solution

you might come up with in C, C++ or Java.

Remember to have #!/usr/bin/env perl as your shebang line.

Remember to use use Modern::Perl; in your program.

Try to follow the Perl Best Practices that weve discussed in class so far

You should only use material presented so far this semester in class, through lecture set of slides #3.

This includes the smart-match operator, relational operators, if conditional statements, the given statement and

Boolean logical operators.

Your error message must start with the label ERROR.

Do not use loops, arrays or the split or substr functions for this assignment.

Make sure to use the use Modern::Perl; statement in your program.

Examples:

Enter a five-digit number: 68182

6 8 1 8 2

Enter a five-digit number: 1234

ERROR: Your number must be in the range 10000 and 99999.

Enter a five-digit number: 01234

ERROR: Your number must be in the range 10000 and 99999.

Enter a five-digit number: 991233

ERROR: Your number must be in the range 10000 and 99999.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Office 365 For Beginners 2022 8 In 1

Authors: James Holler

1st Edition

B0B2WRC1RX, 979-8833565759

More Books

Students also viewed these Databases questions

Question

Recognize the signs of resistance to change.

Answered: 1 week ago

Question

(6) If E(X) = 1 and E(X2) = 2, then the variance is 2. Pg45

Answered: 1 week ago

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago