Loops and if conditions

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

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: EM131063

Questions Cloud

Prepare a portfolio of stocks : Prepare a portfolio of stocks
Describe the organisational culture : Describe the organisational culture or leadership style within Walmart
Prepare an essay on the changing role of the hrd : Prepare an ESSAY on the changing role of the HRD
Rearch paper on managerial succession : Strategic Management class - Rearch paper on Managerial Succession
Loops and if conditions : Write a program that requests a password
Use cases perform a requirements analysis for the case study : Use Cases Perform a requirements analysis for the Case Study
Using .net resources to teach .net : This project will use the .NET framework to produce a set of materials to demonstrate the fundamental principles of .NET. Ideally it should demonstrate some of the principles of the framework e.g. interoperability.
State the multiple regression equation : State the multiple regression equation
Write a report on a new photocopier : Write a report on a new photocopier which the accounting firm can purchase.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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