Write C Program Storing Information Series Balls Collected Person Balls Characteristics 1 Q43905927

Write a C++ program for storing information on a series of ballscollected by a person. The balls should have thesecharacteristics:

1. Diameter in mm

2. Color

3. if the texture of the surface is smooth or rough

4. an identification id/number

The program should allow the person to enter the values for theballs’ attributes as they are entered in a database. The programshould then offer the choice to save all new data into a file.

Next, the program should offer these operations:

1. List all balls with diameters above 10mm (Show all attributevalues)

2. List all balls with less or equal to 10mm (Show all attributevalues)

3. Show all balls that are smooth (Show all attribute values asa list)

4. Show all balls that are rough (Show all attribute values as alist)

5. Find a specific ball based on its id (Show allattributes)

6. How many balls of a specific color are in the database? (Showa total)

Program requirements:

1. The program must be OOP

2. Use of an array as temporary buffer to store ball objects

3. Move content of array to file

4. Retrieve all objects in file to an array at run time

5. Use of menus to direct user on the various available optionsfor the program.

6. Use of header files for the classes need for this program(Use a project setup rather than a single app).

Expert Answer


Answer to Write a C++ program for storing information on a series of balls collected by a person. The balls should have these char…

Write C Program Swaps Two Numbers Without Using Third Variable Q43854522

Write a C program that swaps two numberswithout using a third variable.

Expert Answer


Answer to Write a C program that swaps two numbers without using a third variable….

Write C Program Takes Command Line Arguments Displays Number Consonants Vowels Special Cha Q43898392

Write a C program that takes command line arguments anddisplays the number of consonants, vowels, and special characters.Do not hard code the consonants and specialcharacters.

1. How do you pass each character of the command line argumentto the function printResults?

And how do you get the total amount of characters in everyargument WITHOUT using strlen too many times likethe following:

void printResults(char *str){

int i;

for (i=0; i<strlen(str); i++)

       //whatever goeshere

}

2. How do you implement strlen in the printResults function?

3. How do you count exclamation marks ( ! ) as a character thatcan be read and added as a special character?

Here’s what I have so far:

#include <stdio.h>
#include <string.h>
#include <ctype.h>

void printResults(char *str);
int vowelCheck(char ch);
int specialCheck(char ch);
int consonantCheck(char ch);

int main(int argc, char **argv){
int i = 0;
int j = 0;

//nested for loop
//go through every argument in command line
for (i = 1; i < argc; i ++)
{
      j = 0;

      //go through every characteruntil it reaches the end of string
      while(argv[i][j] != ‘ ‘){
        printf(“Argument %dletter %d: %cn”, i, j, argv[i][j++]);

        //passes the everyelement’s address in the string argument
       printResults(&argv[i][j++]);
        }
}
return 0;
}

//How do you pass every character from the command line argumentto this function?

void printResults(char *str)
{
int i;

//How do you get the length of each command line argument?
int characteramount=strlen(str);

int specialcount=0;

int vowelcount=0;

int consonantcount=0;

for(i=0;i<strlen(str);i++){

      if(specialCheck==1){

         specialcount++;

         }

     if(vowelCheck==1){

         vowelcount++;

         }

    if(consonantCheck==1){

         consonantcount++;

         }

}

printf(“Number of consonants: %d, Number of vowels: %d, Numberof special characters: %d”, consonantcount, vowelcount,specialcount);

}

int vowelCheck(char ch)
{

      if (ch == ‘i’ || ch == ‘a’ || ch== ‘o’ || ch == ‘e’ ||
          ch == ‘u’ ||ch == ‘I’ || ch == ‘A’ || ch == ‘E’ ||
          ch == ‘U’ ||ch == ‘O’)
          return1;
}

int specialCheck(char ch)
{
if(isalpha(c)){
return 1;

}
else{
return 0;

}
}

int consonantCheck(char ch)
{
      if (ch != ‘i’ || ch != ‘a’ || ch !=’o’ || ch != ‘e’ ||
          ch != ‘u’ ||ch != ‘I’ || ch != ‘A’ || ch != ‘E’ ||
          ch != ‘U’ ||ch != ‘O’)
         
          return1;

//or:

if(isalpha(ch)){

   if(vowelcheck(ch)==0){

        return 1;

     }

}

}

Expert Answer


Answer to Write a C program that takes command line arguments and displays the number of consonants, vowels, and special character…

Write C Program Takes Command Line Arguments Prints Original Argument Number Consonants Vo Q43902877

Write a C program that takes command line arguments andprints the original argument with the number of consonants, vowels,and special characters, as well as prints which character makes upthe majority of each argument. Print out the total number ofcharacters of all arguments combined.

Questions:

1. How do I enter multiple exclamation points and have it berecognized as a special character properly? When I input more thanone exclamation point, the compiler thinks there are way morearguments than there are and they aren’t registered as exclamationpoints. For example, when I enter: test!!!!!!.

2. How do I properly implement consonantCheck? The current codedoesn’t print out the correct number of consonants.

3. How do I add the total number of characters of each argumenttogether to get the total number of character of allarguments together? I have the same concern for totalamounts of special characters, consonants, and vowels forcalculations.

Here’s what I have so far:

#include <stdio.h>
#include <string.h>
#include <ctype.h>

void printResults(char *str);
int vowelCheck(char ch);
int specialCheck(char ch);
int consonantCheck(char ch);

int main(int argc, char **argv){
int i = 0;
//go through every argument in command line
for (i = 1; i < argc; i ++)
{
printf(“nargument %d : %s”, i, argv[i]);

//This passes a pointer to the argument to printResults
printResults(argv[i]);
}
return 0;
}

//This checks the characters of the string
void printResults(char *str)
{
int i;

int characteramount=0;

//Trying to get the total amounts of all arguments combined formajority calculations
int totalcharacteramount=0;
int totalspecialcount=0;
int totalvowelcount=0;
int totalconsonantcount=0;

int specialcount=0;

int vowelcount=0;

int consonantcount=0;

//This only goes through each individual argument
for(i=0;i<strlen(str);i++){
//This only counts the amount of characters of each singleargument, not all
//arguments combined.
characteramount++;

if(specialCheck(str[i])==1){

specialcount++;

}

if(vowelCheck(str[i])==1){

vowelcount++;

}

if(consonantCheck(str[i])==1){

consonantcount++;

}

}

printf(“nNumber of consonants: %d, Number of vowels: %d, Numberof special characters: %dn”, consonantcount, vowelcount,specialcount);
printf(“nThe total number of characters: %dn”,totalcharacteramount);

if(totalvowelcount>(totalcharacteramount/2))
printf(“n The majority character in argument %d is vowels.n”,str[i])

if(totalspecialcount>(totalcharacteramount/2))
printf(“n The majority character in argument %d is specialcharacters.n”, str[i])

if(totalconsonantcount>(totalcharacteramount/2))
printf(“n The majority character in argument %d is consonants.n”,str[i])

}

int vowelCheck(char ch)
{

if (ch == ‘i’ || ch == ‘a’ || ch == ‘o’ || ch == ‘e’ ||
ch == ‘u’ || ch == ‘I’ || ch == ‘A’ || ch == ‘E’ ||
ch == ‘U’ || ch == ‘O’) return 1;

return 0;
}

int specialCheck(char ch)
{
if(!isalpha(ch) && !isdigit(ch)){
return 1;

}
return 0;
}

int consonantCheck(char ch)
{
if (ch != ‘i’&& ch != ‘a’ && ch != ‘o’ &&ch != ‘e’ &&
ch != ‘u’ && ch != ‘I’ && ch != ‘A’ && ch!= ‘E’ &&
ch != ‘U’&& ch != ‘O’)

return 1;

//I also tried the following, but it still doesn’t workingif(isalpha(c)){
if(isVowel(c)==0){
    return 1;
}
}

return 0;

}

Expert Answer


Answer to Write a C program that takes command line arguments and prints the original argument with the number of consonants, vowe…

Write C Program Takes Three Arguments Start Temperature Celsius End Temperature Celsius St Q43854582

Write a C program that takes in threearguments, a start temperature (in Celsius), an end temperature (inCelsius) and a step size. Print out a table that goes from thestart temperature to the end temperature, in steps of the step sizeand print the temprature in fahrenheit ; you do not actually needto print the final end temperature if the step size does notexactly match.

Expert Answer


Answer to Write a C program that takes in three arguments, a start temperature (in Celsius), an end temperature (in Celsius) and a…

Write C Program Takes Three Integer Numbers User Find Largest Number Among Q43877395

Write C program that takes three integer numbers from user andfind largest number among them.

Expert Answer


Answer to Write C program that takes three integer numbers from user and find largest number among them….

Write C Program Two Arrays 1 Read 100 Student Numbers Test Scores Keyboard Provide Method Q43823617

Write a C++ program (with two arrays) to: 1. Read up to 100 student numbers and test scores from the keyboard (provide a methWrite a C++ program (with two arrays) to: 1. Read up to 100 student numbers and test scores from the keyboard (provide a method to end the input before reaching 100 records); 2. Display the student numbers and scores in a two column format on the screen; 3. Sort the list according to test scores; 2. Display the student numbers and scores in a two column format on the screen. For example: The list entered: 101 89 102 95 103 76 The list sorted by test scores: 103 76 89 101 102 95 Show transcribed image text Write a C++ program (with two arrays) to: 1. Read up to 100 student numbers and test scores from the keyboard (provide a method to end the input before reaching 100 records); 2. Display the student numbers and scores in a two column format on the screen; 3. Sort the list according to test scores; 2. Display the student numbers and scores in a two column format on the screen. For example: The list entered: 101 89 102 95 103 76 The list sorted by test scores: 103 76 89 101 102 95

Expert Answer


Answer to Write a C++ program (with two arrays) to: 1. Read up to 100 student numbers and test scores from the keyboard (provide a…

Write C Program Use Function Check Given Two Strings Palindromes Q43854564

Write a C program that use function to check ifgiven two strings are palindromes.

Expert Answer


Answer to Write a C program that use function to check if given two strings are palindromes….

Write C Program Uses Function Return Maximum Minimum Values Array One Function Using Point Q43834698

please answer this question with a full explaintion of thework,thaks in advance
Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointe
Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointers. Show transcribed image text Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointers.

Expert Answer


Answer to Write a C program that uses a function to return the maximum and minimum values in an array both in one function using p…

Write C Program Uses Function Return Maximum Minimum Values Array One Function Using Point Q43854641

Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointe

A C program please not C++
Thanks in advance

Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointers. Show transcribed image text Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointers.

Expert Answer


Answer to Write a C program that uses a function to return the maximum and minimum values in an array both in one function using p…