Preview

Nt1310 Unit 3 Assignment 4

Satisfactory Essays
Open Document
Open Document
720 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Nt1310 Unit 3 Assignment 4
Assignment 4 (Chapter 6) (EOP CSC 1100 (Section 3 and 5))
Modularity Using Functions

Question 1: (Practice)
a. Write a function named check() that has three parameters. The first parameter should accept an integer number, and the second and third parameters should accept a double precision number. The function body should just display the values of data passed to the function when it’s called.
b. Include the function written in Exercise 2a in a working program. Make sure your function is called from main(). Test the function by passing various data to it.

Question 2: (Program)
a. The time in hours, minutes, and seconds is to be passed to a function named totsec().
Write totsec() to accept these values, determine the total number
…show more content…
Write a function named ReadOneChar() that reads a key pressed on the keyboard and displays the integer code of the entered character.
b. Include the ReadOneChar() function written for Exercise 10a in a working program.
The main() function should correctly call ReadOneChar() and display the integer the function returns. Test the function by passing various data to it and verifying the returned value.

Question 6: (Program)
a. Write a C++ function named fracpart() that returns the fractional part of any number passed to it. For example, if the number 256.879 is passed to fracpart(), the number
0.879 should be returned.
b. b. Include the function written in Exercise 8a in a working program. Make sure your function is called from main() and returns a value to main() correctly. Have main() use a cout statement to display the returned value. Test the function by passing various data to it and verifying the returned value.
Question 7: (Practice) For the following section of code, determine the data type and scope of all declared variables and symbolic constants on a separate sheet of paper, for example:
Variable or Constant Name
PRICE

Data Type

int

Scope global to main(), roi(), and

You May Also Find These Documents Helpful

  • Good Essays

    Week 1 Lab_ CIS_115

    • 439 Words
    • 2 Pages

    List all variables you will use (use valid variable names). Indicate whether the data type is string, integer, or decimal, and so on.…

    • 439 Words
    • 2 Pages
    Good Essays
  • Better Essays

    if(stfor == NULL && stbck ! = NULL) FCFS(); avg_wt = (float) ttl_wt /i; avg_tt = (float)…

    • 401 Words
    • 2 Pages
    Better Essays
  • Powerful Essays

    Assignment2 Fall 2013

    • 795 Words
    • 5 Pages

    4. There are five problems in total (A.1, A.2, A.3, B, and C). Therefore, your MS Excel file…

    • 795 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    1. Answer Questions #1 & #2 on the exam paper and Questions #3 to #6 in the exam booklet(s). Show computations.…

    • 1903 Words
    • 8 Pages
    Satisfactory Essays
  • Better Essays

    Bio Cells

    • 1019 Words
    • 6 Pages

    4. Post Part 1, Part 2, and Part 3 in this worksheet as an attachment to your Assignment Section. Delete the introductory instructions in this worksheet before you submit it to your instructor.…

    • 1019 Words
    • 6 Pages
    Better Essays
  • Good Essays

    5) The ________ function measures the amount of time that has elapsed between two dates.…

    • 1829 Words
    • 8 Pages
    Good Essays
  • Good Essays

    Physics Midterm Exam

    • 958 Words
    • 4 Pages

    13. Suppose x is an integer variable in a C++ program. Which of the following statements does NOT have a syntax error?…

    • 958 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Hmc Portfolio

    • 326 Words
    • 2 Pages

    2Notice that Exhibit 6 reports only one decimal and so you should _nd the second…

    • 326 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Err in Health

    • 3151 Words
    • 13 Pages

    A) It is your responsibility to read the assignment carefully and make sure you understand what you need to do and what you should hand in. If you are not sure, check with your tutor.…

    • 3151 Words
    • 13 Pages
    Powerful Essays
  • Good Essays

    Mineral Identification

    • 546 Words
    • 3 Pages

    4. Post Part 1, Part 2, and Part 3 in this worksheet as an attachment to your Assignment Section. Delete the introductory instructions in this worksheet before you submit it to your instructor.…

    • 546 Words
    • 3 Pages
    Good Essays
  • Good Essays

    For each of the following parameter-passing methods , what are the values of variables value and list after the two calls to swap?…

    • 479 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Hello

    • 888 Words
    • 4 Pages

    1) prompt the user to enter an integer N (in this document we call the input number N, but of course…

    • 888 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    End FunctionThe name of a function follows the same rules and suggestions we reviewed for sub routines. The DataType factor indicates the type of value that the function will return. If the function will produce a word or a group of words, you can create it as String. If the function will check something and determine whether it produce a true or a false value, you can create it as Boolean. The other data types are also valid in the contexts we reviewed them. As mentioned already, the section between the Function and the End Function lines is the body of the function. It is used to describe what the function does. As done on a sub routine, one of the actions you can perform in a function is to declare a (local) variable and use it as you see fit. Here is an example:…

    • 2932 Words
    • 12 Pages
    Powerful Essays
  • Satisfactory Essays

    Homework 1

    • 386 Words
    • 2 Pages

    B. Program Design – Following the directions in the assignment, clearly write up your problem design in this section and comment your pseudocode.…

    • 386 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    C++ Programs

    • 716 Words
    • 3 Pages

    6. Write a program in C++ to read a set of 10 positive integers and display them all. If the number entered is zero, the program continues reading, but when the user input is a negative number, the program stops reading any further input and displays a message: “a negative number entered”.…

    • 716 Words
    • 3 Pages
    Good Essays