logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Prompt user for number of rows, including the current attempt number and total attempts.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Prerequisites

Completed labs for Lab#1.x thru Lab#5.x

Completed reading Chapter 1-5

Objectives

while loops exercise

do-while loops exercise

for loops exercise

Input validation using loops.

relational and logical expressions

flags

________________________________________

Lab Assignment #6.1

Using loops, write a program to read the number of rows (1-9) and columns (1-9) from user.  User input is validated and a maximum of 3 attempts for each row/column is permitted before program displays error.  When successful input by user, the program will then print 3 different tables with values by iterating through Row# and Column#. 

Program Flow

Step 1: Displays purpose of program.

Step 2: Prompt user for number of rows, including the current attempt number and total attempts.

Enter number of rows from 1-9 (attempts 1/3):

Step 3: Validate number of rows is from 1 to 9.   

Step 4: When number of columns is NOT 1-9. 

a. Print an error message stating

"Invalid number of rows. Must be 1-9. Please try Again." 

b. Then print prompt again with the attempt count increased:

"Enter number of rows from 1-9 (attempts 2/3):" 

Step 5: If number of attempts is exceeded, then print message and end program:

"Exceeded Attempts." 

Step 6: When the user enters a valid number of rows, Prompt user for number of columns, including the current attempt number and total attempts. Entering rows also has 3 attempts.

Enter number of columns from 1-9 (attempts 1/3):

Step 7: Validate number of columns is from 1 to 9.   

Step 8: When number of columns is NOT 1-9. 

a. Print an error message stating 

"Invalid number of columns. Must be 1-9. Please try Again." 

b. Then print prompt again with the attempt count increased:

"Enter number of columns from 1-9 (attempts 2/3):" 

Step 9: If number of attempts is exceeded, then print message and end program:

"Exceeded Attempts."

NOTE: DO NOT use exit(), goto, continue, break, or return statements in the middle of program to end program.  Try to construct the if-statements in a way that the logic drops to end of program. There should be no exit() calls and only 1 return at end of main().

Step 10: At completion of program, 

a. if successful print “Congrats”.  

b. If the program did not succeed, print “Exceeded Attempts”.

 

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

895 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

570 Answers

Hire Me
expert
Husnain SaeedComputer science

643 Answers

Hire Me
expert
Atharva PatilComputer science

833 Answers

Hire Me