Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Printing Pattern A Q1. Write a single program that uses loops to display Patterns A and B (see sample run below). Your first loop will

image text in transcribed

Printing Pattern A Q1. Write a single program that uses loops to display Patterns A and B (see sample run below). Your first loop will display Pattern A, and then write a second loop to display Pattern B. Your program should prompt the user to enter the Height of the pattern. Your program should also include a loop that lets the user repeat the program until the user says he or she is done Printing Pattern B input validation for Height Do not accept zero or a negative value for height. That is if the user; enters 0 or a negative number, your program should prompt the user to re- enter a positive number for the height. Sample Run. Text in red is user entered values # Do you wish to run the program agaln Enter yY to run or n/N to quit: n Enter Helght: 5 Printing Pattern A Q2. A geometric series is defined by the following: aar + ar + ar+ ar a is the first term. r is the "common ratio." n is the number of terms in the series Printing Patterm B Using this information, write a C++ program that uses a loop to display each term and determine the sum of a geometric series. Your program should prompt the user to enter values for a, r, and n. Test your program for a-0.01, r-60, and n-5.0. Make sure your program displays the value it has calculated Do you wish to run the program again Enter yY to run or nN to quit: y Enter Helght: -8 Bonus (Optional): Implement check for input failure. (See Sample Runs 2 and 3 below) Height has to be positive Enter Height: 8 Sample Run 1 (Text in red is user entered values)

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

=+What are the characteristics of these groups?

Answered: 1 week ago

Question

What is the relationship between humans and nature?

Answered: 1 week ago