Program loops and if conditions write a program that

Assignment Help C/C++ Programming
Reference no: EM13347148

PROGRAM LOOPS AND IF CONDITIONS

Write a program that requests a password after the author/program information is displayed. Make the password "hello". The program should then ask the user for their name: if the name entered is the same as your name, the program should respond with

"What a great name!"; if they enter "Madonna" or "Cher", the program should respond

"May I have your autograph, please?". For any aother input, the program should respond with "(input name), that's a nice name".

SAMPLE OUTPUT (including author/program information)

Program author: Barney Rubble
ID#: 1234567
Program 3-LOOPS AND IF CONDITIONS
Password? unicorn
Password? opus
Password? hello
Welcome to the second half of the program!
What is your name? Barney
What a great name!
 
ALTERNATE OUTPUTS
What is your name? Cher
May I have your autograph, please?
What is your name? Bill
Bill, that's a nice name.
 
PROGRAM 4-FUNCTIONS
Rewrite the area.py program (shown below, or in the Creating Functions section of the
tutorial) so that it has separate functions for
the perimeter and area of a square, a rectangle, and a circle (3.14 * radius**2). This
program should include a menu interface that
has 'exit the program' as one of its choices.
 
SAMPLE PROGRAM EXECUTION
Area.py
#This program calculates the perimeter and area of a rectangle
print "Calculate information about a rectangle"
length = input("Length:")
width = input("Width:")
print "Area",length*width
print "Perimeter",2*length+2*width
 
SAMPLE OUTPUT (not including author/program information)
CALCULATIONS MENU
1) AREA (SQUARE)
2) AREA (RECTANGLE) 
3) AREA (CIRCLE)
4) PERIMETER (SQUARE)
5) PERIMETER (RECTANGLE)
6) PERIMETER (CIRCLE)
7) EXIT

INPUT MENU CHOICE (1,2,3,4,5,6 OR 7)? 2

YOU HAVE CHOSEN AREA (RECTANGLE)
INPUT WIDTH? 8
INPUT LENGTH? 4
AREA IS 32
INPUT MENU CHOICE?

Reference no: EM13347148

Questions Cloud

You will be required to prepare a portfolio of 4 stocks : you will be required to prepare a portfolio of 4 stocks with an initial investment of 100000 and track the weekly
Nbsp1briefly trace the development and growth of walmart : nbsp1.briefly trace the development and growth of walmart from 1969 to the present through the application of corporate
Task - you have been asked to prepare a discussion paper : task - you have been asked to prepare a discussion paper essay on the changing role of the human resource department.the
The research paper includes title page abstract body and : the research paper includes title page abstract body and reference page. the paper will culminate the content of the
Program loops and if conditions write a program that : program loops and if conditions write a program that requests a password after the authorprogram information is
Part a - use cases perform a requirements analysis for the : part a - use cases perform a requirements analysis for the case study. express the results using the following
Topic using net resources to teach netthis project will use : topic using .net resources to teach .netthis project will use the .net framework to produce a set of materials to
A consumer products company wants to calculate the : a consumer products company wants to calculate the effectiveness of different types of advertising media in the
Write a report on a new photocopier which the accounting : write a report on a new photocopier which the accounting firm can purchase. in addition to information about its

Reviews

Write a Review

C/C++ Programming Questions & Answers

  A palindrome is a number

A palindrome is a number or text phrase that reads the same backward as forward. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 34543 and 11611. Write a program that reads in a five-digit integer and determines ..

  Calculate and return the average of one of numerical values

Write a method that uses the array to output to the console the list of entries in reverse order. Each entry is displayed on a new line.

  Design a cruiseship class that is derived from ship class

SEN 970 Object-Oriented Programming in Objective-C. Demonstrate the classes in a program that has an array of ship pointers. The array elements should be initialized with the addresses of dynamically allocated Ship, CruiseShip and CargoShip objects..

  Prepare a businesspartner

Prepare a BusinessPartner class that contains a company name, first name and a telephone number.

  Write an interactive program that prompts for a desired sum

Write an interactive program that prompts for a desired sum, then repeatedly rolls two six-sided dice until their sum is the desired sum. Here is the expected dialogue with the user.

  Which of the following are valid case statements in a switch

What will following segment of code output? int x = 5; if (x != 2)      System,out.println( "This is true!"); else      System.out.println( "This is false!");      System.out.println("This is all folks!");

  Draws a pyramid consisting of bricks

Write a C program that draws a pyramid consisting of bricks arranged in horizontal rows, so that the number of bricks in each row decreases by one as you move up the pyramid.

  Function that accepts a pointer to a c-string

Write a function that accepts a pointer to a C-string as an argument and returns the number of words contained in the string. Also have it display the average number of letters in each word.

  Calculation of mortgage interest rates

Instruction of pointers and the calculation of mortgage interest rates.

  Modify it so it gives the ith largest number

the follow code gives the ith smallest number, how do you modify it so it gives the ith largest number ?

  Program to output value of tenth component of array

Write a C++ statements to perform the following: Set value of fourth component of array alpha to three times  value of eight component minus 57.

  Write two short c programs and solve four exam-style

write two short c programs and solve four exam-style problems. details on the programs are as follows.program

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd