Write a function countEven(int*, int) which receives an integer array and its size, and returns the number of even numbers in the array.
Write a program that reads a person’s name in the following format: first name, then middle name or initial, and then last name. The program then outputs the name in the following format: last name, first name. middle initial. For example the input Mary Average User should produce the output User, Mary A.Your program should work the same and place a full stop after the middle initial even if the input did not contain a full stop. Your program should allow for users who give no middle name or initial. In that case, the output of courses contains no middle name or initial. For example, the input Mary User should produce the output User, Mary Your program should also accept names in lowercase, uppercase or a mix of lowercase and uppercase, and display that in the correct format, e.g. if the input is mArY average USER should produce the output User, Mary A.
You have to write a program to read an input file character by character to help Peter solve the following activity in his activity book. The paragraph below is given: We h2pe that 32u e5723ed the acti4it3. A6ter 32u ha4e c2mpleted the acti4it3, 0e5d 32ur re0ult t2: The Acti4it3 C2mpetiti25, Bett3 Da4i0 0treet 99, Auckla5d Park, 989, a5d 0ta5d a cha5ce t2 wi5 a hamper c250i0ti51 26 c2l2uri51 a5d acti4it3 b22k0, c2l2uri51 pe5cil0 a5d pe50. Create an input file activity.dat with the paragraph above. The numbers 0 to 7 have to be replaced as follows: 0 must be replaced by s 1 must be replaced by g 2 must be replaced by o 3 must be replaced by y 4 must be replaced by v 5 must be replaced by n 6 must be replaced by f 7 must be replaced by j Ask the user to input the names of the input and output files. Read the input file character by character, and write the character (if it stays the same) to the output file, or write the changed character to the output file. Call your output file competition.txt
Write a C++ program which perform the following:
1.Create a Class Sequence
2.Create a Private Static Data Member and initialize it with value zero
3.Create a Public Static Member Function , funcStatic ( )to access the static data member
4.Now, access the static member function in Main(), and using Constructor print the following sequence: 0 1 3 6 10 15 21 28
You must design a COVID-19 screening application for your campus. The guards at each gate will screen the students . The capabilities and features of the application should include a choice between the following functions:
1. A screening survey which will allow guards to record the students’ screening data.
*No student should be allowed access to the campus after 12h00 in the afternoons regardless of whether capacity has been reached or not.
*If a student’s temperature is 38 degrees or more, they will not be allowed entry into the campus.
1.Make use of parrel arrays and write the pseudocode that will accurately represent the application you are designing.
Given a string, write a program to re-arrange all the numbers appearing in the string in decreasing order. Note: There will not be any negative numbers or numbers with decimal part.
You must design a COVID-19 screening application for your campus. The guards at each gate will screen the students . The capabilities and features of the application should include a choice between the following functions:
1. A screening survey which will allow guards to record the students’ screening data.
*No student should be allowed access to the campus after 12h00 in the afternoons regardless of whether capacity has been reached or not.
*If a student’s temperature is 38 degrees or more, they will not be allowed entry into the campus.
Write the pseudocode that will accurately represent the application you are designing.
2. Write a class named Pet, which should have the following data attributes:
a) __name (for the name of a pet) __animal_type (for the type of animal that a pet is. Example values are ‘Dog’, ‘Cat’, and ‘Bird’) __age (for the pet’s age) The Pet class should have an __init__ method that creates these attributes.
It should also have the following methods:
b) set_name: This method assigns a value to the __name field. set_animal_type: This method assigns a value to the __animal_type field. set_age: This method assigns a value to the __age field. get_name: This method returns the value of the __name field. get_animal_type: This method returns the value of the __animal_type field. get_age: This method returns the value of the __age field
1. Write a class named Car that has the following data attributes:
a) __year_model (for the car’s year model) __make (for the make of the car) __speed (for the car’s current speed) The Car class should have an __init__ method that accepts the car’s year model and make as arguments. These values should be assigned to the object’s __year_model and __make data attributes. It should also assign 0 to the __speed data attribute.
The class should also have the following methods:
b) Accelerate: The accelerate method should add 5 to the speed data attribute each time it is called. Brake: The brake method should subtract 5 from the speed data attribute each time it is called. get_speed: The get_speed method should return the current speed
Rearrange Numbers in String
Given a string, write a program to re-arrange all the numbers appearing in the string in decreasing order. Note: There will not be any negative numbers or numbers with decimal part.
The input will be a single line containing a string.
The output should be a single line containing the modified string with all the numbers in string re-ordered in decreasing order.
For example, if the given string is "I am 5 years and 11 months old", the numbers are 5, 11. Your code should print the sentence after re-ordering the numbers as "I am 11 years and 5 months old".
Sample Input
I am 5 years and 11 months old
Sample Output
I am 11 years and 5 months old
Sample Input
3times4is12
Sample output
12times4is3