Assignment 4
You are given a list of numbers:
[28, 22, 7, 2, 8, 14, 24, 56]
Your task is to find a conglomerate of numbers from this list, such that the conglomerate satisfies the "divisibility requirement." You may assume the list contains integers, no negative values, and no duplicates.
The Divisibility Requirement
Select any two numbers from the conglomerate L and S. For those two numbers one of them will be larger, and the other will be smaller. Let's say L is larger. The divisibility requirement states L % S == 0.
More concisely, the divisibility requirement holds for a conglomerate iff...
For all L and S in the conglomerate, L % S = 0 where L > S
For example, in the above list there is a conglomerate {14, 2, 7}. This conglomerate does not satisfy the divisibility requirement because 7 % 2 != 0.
Another example from the list above is the conglomerate {8, 2, 24}. This conglomerate satisfies the divisibility requirement because all the pairings demonstrate perfect divisibility: 8 % 2 == 0 (8/2 = 4 exactly), 24 % 8 == 0, and 24 % 2 == 0.
However {8, 2, 24} is not the biggest conglomerate that can be found that satisfies the divisibility requirement. That would be: {7, 14, 28, 56}. Actually, there are multiple possible answers for this list. Another would be: (2, 14, 28, 56).
Code Details
Write a program that finds the biggest conglomerate for a given list of numbers. Of course the conglomerate must satisfy the divisibility requirement. You have been given a file main.cpp and the biggest_divisible_conglomerate.h header file. You should write a biggest- divisible-conglomerate.cpp file which interfaces with both of them. And, you should write a Makefile to compile the program to a binary called bdc.
Note #1: You may write a test () function, or you might want to hard-code some more test list(s) into the main method. In either case, know that your program will be tested (graded) using a variety of input lists. Your program should work if the input list is empty or a list of one number.
Note #2: In general your program only needs to output one solution for a given input, even when there are multiple solutions possible.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of