Question

In: Computer Science

* What does it mean when header files are described as making a program “modular?” What...

* What does it mean when header files are described as making a program “modular?” What are the advantages of this?

* You are testing a program that is designed to take in a pair of float values as input. The intended range is from -50.50 to 100.25. What are 10 test cases you would use to test this program, bearing in mind each test case is a set of two numbers? Briefly justify your choices.

Solutions

Expert Solution

1.

Let's say that in 1 file we implemented a class with all its functions and then we #include<"file"> in our main program which is going to execute,so in this way we can directly create the object of that class ,without including that in our main file,so in this way we make our program as modular.Let's study a bit about this modular programming:-

Modular programming is the process of subdividing a computer program into separate sub-programs.

A module is a separate software component. It can often be used in a variety of applications and functions with other components of the system. Similar functions are grouped in the same unit of programming code and separate functions are developed as separate units of code so that the code can be reused by other applications.

Object-oriented programming (OOP) is compatible with the modular programming concept to a large extent. Modular programming enables multiple programmers to divide up the work and debug pieces of the program independently.

Modules in modular programming enforce logical boundaries between components and improve maintainability. They are incorporated through interfaces. They are designed in such a way as to minimize dependencies between different modules. Teams can develop modules separately and do not require knowledge of all modules in the system.

Each and every modular application has a version number associated with it. This provides developers flexibility in module maintenance. If any changes have to be applied to a module, only the affected subroutines have to be changed. This makes the program easier to read and understand.

The benefits of using modular programming include:

  • Less code has to be written.
  • A single procedure can be developed for reuse, eliminating the need to retype the code many times.
  • Programs can be designed more easily because a small team deals with only a small part of the entire code.
  • Modular programming allows many programmers to collaborate on the same application.
  • The code is stored across multiple files.
  • Code is short, simple and easy to understand.
  • Errors can easily be identified, as they are localized to a subroutine or function.
  • The same code can be used in many applications.
  • The scoping of variables can easily be controlled.

2. -50.50 to 100.25

i) (-50.50,100.25)

ii)(-50.51,100.26)

iii)(-50.51,100.24)

iv)(-50.50,100.26)

v)(-50.50,100.24)

vi)(-50.49,100.24)

vii)(-50.51,-50.52)

viii)(100.26,100.27)

ix)(100.25,100.26)

x)(-50.50,-50.51)


Related Solutions

How do you use header files on a program? I need to separate my program into...
How do you use header files on a program? I need to separate my program into header files/need to use header files for this program.Their needs to be 2-3 files one of which is the menu. thanks! #include #include #include using namespace std; const int maxrecs = 5; struct Teletype { string name; string phoneNo; Teletype *nextaddr; }; void display(Teletype *); void populate(Teletype *); void modify(Teletype *head, string name); void insertAtMid(Teletype *, string, string); void deleteAtMid(Teletype *, string); int find(Teletype...
WRITE ONLY THE TO DO'S   in FINAL program IN C++ (necessary cpp and header files are...
WRITE ONLY THE TO DO'S   in FINAL program IN C++ (necessary cpp and header files are witten below) "KINGSOM.h " program below: #ifndef WESTEROS_kINGDOM_H_INCLUDED #define WESTEROS_KINGDOM_H_INCLUDED #include <iostream> namespace westeros { class Kingdom{         public:                 char m_name[32];                 int m_population; };         void display(Kingdom&);                      } #endif } Kingdom.cpp Program below: #include <iostream> #include "kingdom.h" using namespace std; namespace westeros {         void display(Kingdom& pKingdom) {                 cout << pKingdom.m_name << ", population " << pKingdom.m_population << endl;                                                               FINAL:...
What does it mean when a force is described as “conservative”? Give one example of a...
What does it mean when a force is described as “conservative”? Give one example of a conservative force and one example of a non-conservative force
What is the hash value of a file, and what does it mean if two files...
What is the hash value of a file, and what does it mean if two files have the same hash value?
What does “program to interfaces, not implementations” mean?
What does “program to interfaces, not implementations” mean?
What does it mean if the linear program exhibits unboundedness?
What does it mean if the linear program exhibits unboundedness?
What does making a personal business model canvas mean when becoming an entrepreneur/acting in entrepreneurial ways?
What does making a personal business model canvas mean when becoming an entrepreneur/acting in entrepreneurial ways?
what does it mean when the offspring decreased?
what does it mean when the offspring decreased?
What does it mean when culture is commodified?
What does it mean when culture is commodified?What is the impact on intercultural communication?Explain and provide an example.
What does it mean when LSCs are quiescent?
What does it mean when LSCs are quiescent?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT