Write a program that prompts the user to input any digit then swap the position of the first and the last digit. Next, the user will be prompt to select what arithmetic operation he/she want to employ on the first and last digit based on the following choices: 1. Sum of their square 2. Product of their square root

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a program that prompts the user to input any digit then swap the position of the first and the last digit. Next, the user will be prompt to select what arithmetic operation he/she want to employ on the first and last digit based on the following choices:

1. Sum of their square

2. Product of their square root

3. Square of their product

 

The output will display the result of the arithmetic operation followed by the digit with a swapped position of “first” and “last” digit. Then finally display the equivalent uppercase alphabet for the first digit and lowercase alphabet for the last digit respectively after swapping.

Note:

1.    If the last digit of the inputted digit from the user is zero, it must display that there is no equivalent alphabet for that digit.

2.    If the user chooses arithmetic operation No.2, format the output to three decimal places

 

TEST CASES:

If a user inputs a digit and choose arithmetic operation No.1:

Input any number: 97834

Select an arithmetic operation that you want to implement for the 'first' and 'last' digit:
1. Sum of their square
2. Product of their square root
3. Square of their product 

Choose between 1 - 3: 1
The Sum of their square is 97
The number after swapping the first and last digits are: 47839
The equivalent uppercase alphabet for the first digit, 4, after swapping is D.
The equivalent lowercase alphabet for the last digit, 9, after swapping is i.

If a user input a digit where the last digit is a zero:
Input any number: 67450

Select an arithmetic operation that you want to implement for the 'first' and 'last' digit:
1. Sum of their square
2. Product of their square root
3. Square of their product

Choose between 1 - 3: 2

The Product of their square root is 0.000
The number after swapping the first and last digits are: 7456
The first digit after swapping is 0. No equivalent alphabet!
The equivalent lowercase alphabet for the last digit, 6, after swapping is f

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY