Preview

Imperial Units and Optic Calculator Program

Satisfactory Essays
Open Document
Open Document
453 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Imperial Units and Optic Calculator Program
PT1420 - Unit 2 Homework and Lab Assignment

Unit 2 Assignment 1: Homework (material from Chapter 2of your text book)
1.) What is pseudocode? A.) Pseudocode is when you pre write a program in your own type of language to lay it out
2.) Computer programs typically perform what 3 steps. A.)Input, Process, Output.
3.) What 2 things must you normally specify in a variable declaration. A.)Type, Identifier.
4.) Write assignment statements that perform the following operations with the variables a, b, and c:
a. Adds 2 to a and stores the result in b// Ans.)B = 2 + A
b. Multiples b times 4 and stores the result in a //Ans.)A = B * 4
c. Divides a by 3.14 and stores the result in b//Ans.)B = A / 3.14
d. Subtracts 8 from b and stores the result in a//Ans.) A = B – 8
5.) Write the pseudocode for a program that will determine the average miles per gallon a car gets. (Inputs should be miles driven and gallons of gas used)

Ans.) Input: How many miles have you driven?, How many gallons of gas did you have?
Process: Divide miles by gas to get average.
Output: Display average miles per gallon.

*****************************************************************

Unit 2 Labs

Problem:

Write a program that will calculate the cost of installing fiber optic cable at a cost of .87 per foot for a company. Your program should display the company name, number of feet installed, and the total cost for the installation.

1.) 2.1: Pseudocode

Variable Table

Purpose of Variable
Variable Name
Stores the cost of fiber
.87
Stores the company name
Business
Stores number of feet to be installed
Installed Feet
Stores calculated cost of installed fiber
Total Cost

Pseudocode:

Display “Welcome to the Fiber Optic Calculator Program”
Set fiberCost = 0.87
Display “What is the Company Name?”
Input Business
Display “How many feet of fiber will be installed?”
Input 10
Set Cost
Display “Company Name: “, Business
Display “Feet of cable

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Mm207 Unit 2

    • 520 Words
    • 3 Pages

    Use the second given value as the reference value. Also, write a statement describing the result.…

    • 520 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    12. The STO→ button stores numbers to variables. To evaluate the expression23 4 a c b + −, press 9 STO→ ALPHA MATH ENTER to store the number 9 to A. Repeat this same process if B = 2 and C = 1, then evaluate the expression by…

    • 641 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    Java Chapter 2 Quiz

    • 2047 Words
    • 9 Pages

    6. A(n) ____ is a value that is written into the code of a program.…

    • 2047 Words
    • 9 Pages
    Powerful Essays
  • Satisfactory Essays

    UNIT 2

    • 470 Words
    • 3 Pages

    Write a program that will calculate the cost of installing fiber optic cable at a cost of .87 per foot for a company. Your program should display the company name, number of feet installed, and the total cost for the installation.…

    • 470 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Petries Week 5

    • 372 Words
    • 2 Pages

    a. I don’t know how to do this. Will you please let me know what to do so I can do it and turn it in before Sunday.…

    • 372 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    In practical activities and discussion begin to use the vocabulary involved in adding and subtracting…

    • 3194 Words
    • 16 Pages
    Powerful Essays
  • Satisfactory Essays

    Prints the result that is, 275 on a piece of paper and puts it in the out box.…

    • 556 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    drtgdr

    • 560 Words
    • 8 Pages

    a + b = (a1 , a2 , . . . , an ) + (b1 , b2 , . . . , bn )…

    • 560 Words
    • 8 Pages
    Satisfactory Essays
  • Powerful Essays

    Pseudo Code

    • 1310 Words
    • 5 Pages

    A variable is used as a storage location for values and unknown quantities. It can be used is used to reference the stored value. The name and content are separate this allows the name to be used independently but still keeping the value exact. This is important as the value might change during the course of program execution.…

    • 1310 Words
    • 5 Pages
    Powerful Essays
  • Good Essays

    Local Variable: integer I in the loop: for (int I = 0; I < 5; I++)…

    • 22711 Words
    • 91 Pages
    Good Essays
  • Powerful Essays

    Binary Numeral System

    • 2195 Words
    • 9 Pages

    3- 1 's and 2 's Complement of Binary Number. 4- Hexadecimal Addition &Subtraction.…

    • 2195 Words
    • 9 Pages
    Powerful Essays
  • Satisfactory Essays

    Java Calculator CMD

    • 889 Words
    • 4 Pages

    Division"); op = fSC.nextInt(); System.out.println("Enter second number:"); b = fSC.nextInt(); if (op==1) { c = a+b; } else if (op==2) { c = a-b;} else if (op==3) { c = a*b;} else if (op==4) { c = a/b; } else { System.out.println("You have entered a wrong operator value !"); System.exit(0); } System.out.println("The Answer is "+c); } } import java.util.…

    • 889 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    As we identify the six basic computer operations that are used to write computer programs, use of pseudo code terms will also help identify if the particular action being described is part of the program’s input, processing, or output component of the program. The six basic computer operations are:…

    • 1015 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    M (f ( ) f ( ) ... f ( )) n n = + ++ hm m m 1 2 , where b a h…

    • 416 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    COMPUTER PROGRAMMING Programming languages for computers are developed with the primary objective of facilitating a large number of persons to use computers without the need to know in detail the internal structure of a computer. Languages are matched to the type of applications which are to be programmed using the language. The ideal language would be one which expresses precisely the specification of a problem to be solved, and converts it into a series of instructions for a computer. It is not possible to achieve this ideal as a clear specification of a problem is often not available and developing an algorithm from specifications requires subject knowledge and expertise. In actual practice, a detailed algorithm to solve a problem is the starting point and it is expressed as a program in a programming language. A large number of languages, over a thousand, exist each catering to a different class of applications. All modern programming languages (with one exception) are designed to be machine independent. In other words, the structure of the programming language would not depend upon the internal structure of a specified computer; one should be able to execute a program written in the programming language on any computer regardless of who manufactured it or what model it is. Programing Language is a set of instructions (codes) that controls a computer to perform some processing function or combination of functions. For the instructions to be carried out, a computer must execute a program, that is, the computer reads the program, and then follows the steps encoded in the program in a precise order until completion. A program can be executed many different times, with each execution yielding a potentially different result depending upon the options and data that the user gives the computer. It can also be simply defined as the process of specifying objects and the ways in which those objects interact to solve a problem. A computer is not intelligent. It cannot…

    • 2590 Words
    • 11 Pages
    Powerful Essays