Free Essay

Pseudocode - Using Functions to Solve Dimensions of Rectangle

In:

Submitted By DivinedZero
Words 280
Pages 2
PseudoCode :

//This program will calculate the area and perimeter using different functions.
//The numerical values for length and width will be provided as an input by the user
//Set function areaofrec as float
//Set function periofrec as float

//START Program

//set menuSelect, intValue as int
//set length, width, and result as float

//set while loop (while intValue >0) continue loop
//print “Enter a positive integer to calculate the area or perimeter of a rectangle; “
//print “OR a negative integer to exit program”
//input positive or negative integer

//create if else statement
//If intValue >0 continue with program
//else if intValue < 0 exit program
//if intValue > 0 print “Enter 1 to calculate area, 2 to calculate perimeter”
//input menuSelect option

//if menuSelect == 1
//call the area function
//print “you chose to calculate the area of the rectangle!”
//print “please enter the length and width of the rectangle”
//print “enter length first, hit enter, enter width, hit enter”
//input length and width
//set result = areaofrec(length,width)
//print result “The area of the rectangle is (result) “

//else if menuSelect == 2
//call the perimeter function
//print “you chose to calculate the perimeter of the rectangle!”
//print “please enter the length and width of the rectangle”
//print “enter length first, hit enter, enter width, hit enter”
//input length and width
//set result = periofrec(length,width)
//print result “The perimeter of the rectangle is (result) “

//else if menuSelect != 1 or 2
//print “invalid manu item, only 1 or 2 accepted”

//End Program

//set function returning the area of a rectangle
//set areaofrec(length,width)
// return length*width

//set function returning the perimeter of a rectangle
//set periofrec(length,width)
// return (length*2)+(width*2)

Similar Documents

Premium Essay

Write a Program, Using Functions, That Calculates the Area and Permieter of a Rectangle Whose Dimensions (Length and Width) Are Provided by a User

...program, using functions, that calculates the area and perimeter of a rectangle whose dimensions (Length and width) are provided by a user. Assume the rooms are rectangular and that the user can enter from 1 to 10 rooms for the house. Also calculate and display the total area and total perimeter (i.e. the sum of the perimeters) of the house. Note: this is very similar to Assignment 1 and you can reuse any code there that is appropriate. Before attempting this exercise, be sure you have completed all of chapter 8 and course module readings, participated in the weekly conferences, and thoroughly understand the examples throughout the chapter.   There are 4 main components of your submission including the problem analysis, program design and documentation, and sample test data.1. Provide your analysis for the following problem statement: You need to write a program that calculates the area and perimeter of a rectangle whose dimensions (Length and width) are provided by a user.Your analysis should be clearly written and demonstrate your thought process and steps used to analyze the problem. Be sure to include what is the required output? What is the necessary input and how you will obtain the required output from the given input? Also, include your variable names and definitions. Be sure to describe any necessary formulas and sample calculations.2. Provide your program design for the problem you analyzed for calculating and displaying the area and perimeter of a rectangle.  Always...

Words: 471 - Pages: 2

Free Essay

Machine Learning

...Foundations of Machine Learning Adaptive Computation and Machine Learning Thomas Dietterich, Editor Christopher Bishop, David Heckerman, Michael Jordan, and Michael Kearns, Associate Editors A complete list of books published in The Adaptive Computations and Machine Learning series appears at the back of this book. Foundations of Machine Learning Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar The MIT Press Cambridge, Massachusetts London, England c 2012 Massachusetts Institute of Technology All rights reserved. No part of this book may be reproduced in any form by any electronic or mechanical means (including photocopying, recording, or information storage and retrieval) without permission in writing from the publisher. MIT Press books may be purchased at special quantity discounts for business or sales promotional use. For information, please email special sales@mitpress.mit.edu or write to Special Sales Department, The MIT Press, 55 Hayward Street, Cambridge, MA 02142. A This book was set in L TEX by the authors. Printed and bound in the United States of America. Library of Congress Cataloging-in-Publication Data Mohri, Mehryar. Foundations of machine learning / Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar. p. cm. - (Adaptive computation and machine learning series) Includes bibliographical references and index. ISBN 978-0-262-01825-8 (hardcover : alk. paper) 1. Machine learning. 2. Computer algorithms. I. Rostamizadeh, Afshin. II...

Words: 137818 - Pages: 552

Premium Essay

Analysis

...SEVENTH EDITION PROBLEM SOLVING AND PROGRAM DESIGN in C This page intentionally left blank SEVENTH EDITION PROBLEM SOLVING AND PROGRAM DESIGN in C Jeri R. Hanly, University of Wyoming Elliot B. Koffman, Temple University Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Editorial Director, ECS: Marcia Horton Editor-in-Chief: Michael Hirsch Senior Project Manager: Carole Snyder Director of Marketing: Patrice Jones Marketing Manager: Yezan Alayan Senior Marketing Coordinator: Kathryn Ferranti Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Associate Managing Editor: Robert Engelhardt Production Manager: Pat Brown Creative Director: Jayne Conte Designer: Suzanne Behnke Media Editor: Daniel Sandin Media Project Manager: John Cassar Cover Image: (c) michael Holcomb/Shutterstock.com Full-Service Project Management: Mohinder Singh/ Aptara®, Inc. Composition: Aptara®, Inc. Printer/Binder: Edwards Brothers Cover Printer: Lehigh-Phoenix Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on appropriate page within text. Photo Credits: Page 4: Fig. 0.1: akg-images/Paul Almasy/Newscom. Page 11: Fig. 0.4: © 2008 IEEE/Journal of Microelectromechanical Systems (2006). Page 15:...

Words: 158087 - Pages: 633

Premium Essay

Data Mining Practical Machine Learning Tools and Techniques - Weka

...Data Mining Practical Machine Learning Tools and Techniques The Morgan Kaufmann Series in Data Management Systems Series Editor: Jim Gray, Microsoft Research Data Mining: Practical Machine Learning Tools and Techniques, Second Edition Ian H. Witten and Eibe Frank Fuzzy Modeling and Genetic Algorithms for Data Mining and Exploration Earl Cox Data Modeling Essentials, Third Edition Graeme C. Simsion and Graham C. Witt Location-Based Services Jochen Schiller and Agnès Voisard Database Modeling with Microsoft® Visio for Enterprise Architects Terry Halpin, Ken Evans, Patrick Hallock, and Bill Maclean Designing Data-Intensive Web Applications Stefano Ceri, Piero Fraternali, Aldo Bongio, Marco Brambilla, Sara Comai, and Maristella Matera Mining the Web: Discovering Knowledge from Hypertext Data Soumen Chakrabarti Understanding SQL and Java Together: A Guide to SQLJ, JDBC, and Related Technologies Jim Melton and Andrew Eisenberg Database: Principles, Programming, and Performance, Second Edition Patrick O’Neil and Elizabeth O’Neil The Object Data Standard: ODMG 3.0 Edited by R. G. G. Cattell, Douglas K. Barry, Mark Berler, Jeff Eastman, David Jordan, Craig Russell, Olaf Schadow, Torsten Stanienda, and Fernando Velez Data on the Web: From Relations to Semistructured Data and XML Serge Abiteboul, Peter Buneman, and Dan Suciu Data Mining: Practical Machine Learning Tools and Techniques with Java Implementations Ian H. Witten and Eibe Frank ...

Words: 191947 - Pages: 768

Free Essay

Design Pattern

........................................................... 5 Preface to Book ...................................................... 7 Foreword ............................................................. 9 Guide to Readers .................................................... 10 1 Introduction ...................................................... 11 1.1 What Is a Design Pattern? ...................................... 12 1.2 Design Patterns in Smalltalk MVC ............................... 14 1.3 Describing Design Patterns ..................................... 16 1.4 The Catalog of Design Patterns ................................. 18 1.5 Organizing the Catalog ......................................... 21 1.6 How Design Patterns Solve Design Problems ...................... 23 1.7 How to Select a Design Pattern ................................. 42 1.8 How to Use a Design Pattern .................................... 44 2 A Case Study: Designing a Document Editor ......................... 46 2.1 Design Problems ................................................ 46 2.2 Document Structure ............................................. 47 2.3 Formatting ..................................................... 53 2.4 Embellishing the User Interface ................................ 56 2.5 Supporting Multiple Look-and-Feel Standards .................... 60 2.6 Supporting Multiple Window Systems ............................. 64 2.7 User Operations ....................................

Words: 84976 - Pages: 340

Premium Essay

Dataminig

...further information about the Publisher’s permissions policies and our arrangements with organizations such as the Copyright Clearance Center and the Copyright Licensing Agency, can be found at our website: www.elsevier.com/permissions. This book and the individual contributions contained in it are protected under copyright by the Publisher (other than as may be noted herein). Notices Knowledge and best practice in this field are constantly changing. As new research and experience broaden our understanding, changes in research methods, professional practices, or medical treatment may become necessary. Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any information, methods, compounds, or experiments described herein. In using such information or methods they should be mindful of their own safety and the safety of others, including parties for whom they have a professional responsibility. To the fullest extent of the law, neither the Publisher nor the authors,...

Words: 194698 - Pages: 779

Free Essay

Research Paper

...www.it-ebooks.info www.it-ebooks.info Programming Interviews Exposed: Secrets to Landing Your Next Job Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix Chapter 1 Before the Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 2 The Job Application Process. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Chapter 3 Approaches to Programming Problems. . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Chapter 4 Linked Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Chapter 5 Trees and Graphs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Chapter 6 Arrays and Strings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

Words: 48008 - Pages: 193

Free Essay

Student

...CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION This page intentionally left blank CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION R OB E RT W. S EB ES TA University of Colorado at Colorado Springs Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Vice President and Editorial Director, ECS: Marcia Horton Editor in Chief: Michael Hirsch Executive Editor: Matt Goldstein Editorial Assistant: Chelsea Kharakozova Vice President Marketing: Patrice Jones Marketing Manager: Yez Alayan Marketing Coordinator: Kathryn Ferranti Marketing Assistant: Emma Snider Vice President and Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Senior Production Project Manager: Marilyn Lloyd Manufacturing Manager: Nick Sklitsis Operations Specialist: Lisa McDowell Cover Designer: Anthony Gemmellaro Text Designer: Gillian Hall Cover Image: Mountain near Pisac, Peru; Photo by author Media Editor: Dan Sandin Full-Service Vendor: Laserwords Project Management: Gillian Hall Printer/Binder: Courier Westford Cover Printer: Lehigh-Phoenix Color This book was composed in InDesign. Basal font is Janson Text. Display font is ITC Franklin Gothic. Copyright © 2012, 2010, 2008, 2006, 2004 by Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Manufactured...

Words: 142312 - Pages: 570

Free Essay

Concepts of Programming Languages

...CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION This page intentionally left blank CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION R O B E RT W. S EB ES TA University of Colorado at Colorado Springs Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Vice President and Editorial Director, ECS: Marcia Horton Editor in Chief: Michael Hirsch Executive Editor: Matt Goldstein Editorial Assistant: Chelsea Kharakozova Vice President Marketing: Patrice Jones Marketing Manager: Yez Alayan Marketing Coordinator: Kathryn Ferranti Marketing Assistant: Emma Snider Vice President and Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Senior Production Project Manager: Marilyn Lloyd Manufacturing Manager: Nick Sklitsis Operations Specialist: Lisa McDowell Cover Designer: Anthony Gemmellaro Text Designer: Gillian Hall Cover Image: Mountain near Pisac, Peru; Photo by author Media Editor: Dan Sandin Full-Service Vendor: Laserwords Project Management: Gillian Hall Printer/Binder: Courier Westford Cover Printer: Lehigh-Phoenix Color This book was composed in InDesign. Basal font is Janson Text. Display font is ITC Franklin Gothic. Copyright © 2012, 2010, 2008, 2006, 2004 by Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Manufactured in the United States...

Words: 142253 - Pages: 570

Premium Essay

Cd Key

...Java Quick Reference Console Input Scanner input = new Scanner(System.in); int intValue = input.nextInt(); long longValue = input.nextLong(); double doubleValue = input.nextDouble(); float floatValue = input.nextFloat(); String string = input.next(); Console Output System.out.println(anyValue); JOptionPane.showMessageDialog(null, "Enter input"); GUI Input Dialog String string = JOptionPane.showInputDialog( "Enter input"); int intValue = Integer.parseInt(string); double doubleValue = Double.parseDouble(string); Message Dialog Primitive Data Types byte short int long float double char boolean 8 bits 16 bits 32 bits 64 bits 32 bits 64 bits 16 bits true/false Arithmetic Operators + * / % ++var --var var++ var-addition subtraction multiplication division remainder preincrement predecrement postincrement postdecrement Assignment Operators = += -= *= /= %= assignment addition assignment subtraction assignment multiplication assignment division assignment remainder assignment Relational Operators < >= == != less than less than or equal to greater than greater than or equal to equal to not equal Logical Operators && || ! ^ short circuit AND short circuit OR NOT exclusive OR if Statements if (condition) { statements; } if (condition) { statements; } else { statements; } if (condition1) { statements; } else if (condition2) { statements; } else { statements; } switch Statements switch (intExpression) { case value1: statements; break; ... case valuen: statements; break;...

Words: 73366 - Pages: 294

Premium Essay

Study Guide

...® OCA Oracle Database 11g: SQL Fundamentals I Exam Guide (Exam 1Z0-051) ABOUT THE AUTHORS John Watson (Oxford, UK) works for BPLC Management Consultants, teaching and consulting throughout Europe and Africa. He was with Oracle University for several years in South Africa, and before that worked for a number of companies, government departments, and NGOs in England and Europe. He is OCP qualified in both database and Application Server administration. John is the author of several books and numerous articles on technology and has 25 years of experience in IT. Roopesh Ramklass (South Africa), OCP, is an independent Oracle specialist with over 10 years of experience in a wide variety of IT environments. These include software design and development, systems analysis, courseware development, and lecturing. He has worked for Oracle Support and taught at Oracle University in South Africa for several years. Roopesh is experienced in managing and executing IT development projects, including infrastructure systems provisioning, software development, and systems integration. About the Technical Editor Bruce Swart (South Africa) works for 2Cana Solutions and has over 14 years of experience in IT. Whilst maintaining a keen interest for teaching others, he has performed several roles including developer, analyst, team leader, administrator, project manager, consultant, and lecturer. He is OCP qualified in both database and developer roles. He has taught at Oracle University...

Words: 150089 - Pages: 601

Premium Essay

Puzzles

...TeA M YYe PG Digitally signed by TeAM YYePG DN: cn=TeAM YYePG, c=US, o=TeAM YYePG, ou=TeAM YYePG, email=yyepg@msn .com Reason: I attest to the accuracy and integrity of this document Date: 2005.07.04 23:45:43 +08'00' ������������ Want to learn more? We hope you enjoy this McGraw-Hill eBook! If you’d like more information about this book, its author, or related books and websites, please click here. HOW TO ACE THE BRAINTEASER INTERVIEW JOHN KADOR M C G R AW- H I L L N E W YO R K MADRID C H I C AG O SAN FRANCISCO MILAN SYDNEY LISBON TO RO N TO LONDON S A N J UA N MEXICO CITY SEOUL NEW DELHI SINGAPORE Copyright © 2005 by John Kador. All rights reserved. Manufactured in the United States of America. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher. 0-07-144606-0 The material in this eBook also appears in the print version of this title: 0-07-144001-1. All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps. McGraw-Hill eBooks are available at special...

Words: 77414 - Pages: 310

Premium Essay

Asignment

...and industrial property laws. Reverse engineering, disassembly, or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. This document is not warranted to be error-free. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose. If the Programs are delivered to the United States Government or anyone licensing or using the Programs on behalf of the United States Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and...

Words: 199783 - Pages: 800

Premium Essay

Databasse Management

...Fundamentals of Database Systems Preface....................................................................................................................................................12 Contents of This Edition.....................................................................................................................13 Guidelines for Using This Book.........................................................................................................14 Acknowledgments ..............................................................................................................................15 Contents of This Edition.........................................................................................................................17 Guidelines for Using This Book.............................................................................................................19 Acknowledgments ..................................................................................................................................21 About the Authors ..................................................................................................................................22 Part 1: Basic Concepts............................................................................................................................23 Chapter 1: Databases and Database Users..........................................................................................23 ...

Words: 229471 - Pages: 918

Free Essay

Management Concept

...Software Engineering: A Practitioner's Approach Copyright © 1996, 2001 R.S. Pressman & Associates, Inc. For University Use Only May be reproduced ONLY for student use at the university level When used in conjunction with Software Engineering: A Practitioner's Approach. Any other reproduction or use is expressly prohibited. Chapter 1 The Product CHAPTER OVERVIEW AND COMMENTS The goal of this chapter is to introduce the notion of software as a product designed and built by software engineers. Software is important because it is used by a great many people in society. Software engineers have a moral and ethical responsibility to ensure that the software they design does no serious harm to any people. Software engineers tend to be concerned with the technical elegance of their software products. Customers tend to be concerned only with whether or not a software product meets their needs and is easy to use. 1.1 The Evolving Role of Software The main point of this section is that the primary purpose of software is that of information transformer. Software is used to produce, manage, acquire, modify, display, and transmit information anywhere in the world. The days of the lone programmer are gone. Modern software is developed by teams of software specialists. Yet, the software developer's concerns have remained the same. Why does software take so long to complete? Why does it cost so much to produce? Why can't all errors be found and removed...

Words: 43682 - Pages: 175