Question: int binary _ to _ decimal ( string s ) ; / / precondition: s is a string that consists of only 0 s and

int binary_to_decimal(string s);
// precondition: s is a string that consists of only 0s and 1s
// postcondition: the positive decimal integer that is represented by s
string decimal_to_binary(int n);
// precondition: n is a positive integer
// postcondition: ns binary representation is returned as a string of 0s and 1s
string add_binaries(string b1, string b2);
// precondition: b1 and b2 are strings that consists of 0s and 1s, i.e.
// b1 and b2 are binary representations of two positive integers
// postcondition: the sum of b1 and b2 is returned. For instance,
// if b1=11, b2=01, then the return value is 100
void menu();
// display the menu. Student shall not modify this function
int grade();
// returns an integer that represents the students grade of this projects.
// Student shall NOT modify
bool is_binary(string b);
// returns true if the given string s consists of only 0s and 1s; false otherwise
bool test_binary_to_decimal();
// returns true if the students implementation of binary_to_decimal function
// is correct; false otherwise. Student shall not modify this function
bool test_decimal_to_binary();
// returns true if the students implementation of decimal_to_binary function is correct; false otherwise. Student shall not modify this function
bool test_add_binaries();
// which returns true if the students implementation of add_binaries function
// is correct; false otherwise. Student shall not modify this function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!