Instructions Write a C program to create an array of characters of size 6 Populate the array

Instructions: - Write a C program to create an array of characters of size 6. - Populate the array with letters using a function named populateArray. - Display the contents of the array using another function named displayArray. - Print only the vowels in the array using a function named printVowels. Hint: - Use scanf to read user input for each array element. - To identify vowels, use an if statement to check against 'A', 'a', 'E', 'e', 'I', etc. - Alternatively, look up the ctype.h functions. - Ex. the islower() function checks whether a character is lowercase. islower('E') would return 0 (false). - That true or false result can be used in an if statement. - Remember to #include.

Instructions: – Write a C program to create an array of characters of size 6. – Populate the array with letters using a function named populateArray. – Display the contents of the array using another function named displayArray. – Print only the vowels in the array using a function named printVowels. Hint: – Use scanf to read user input for each array element. – To identify vowels, use an if statement to check against ‘A’, ‘a’, ‘E’, ‘e’, ‘I’, etc. – Alternatively, look up the ctype.h func

Read More

Write a Python program to implement the Student Management System i Each student record consists

Write a Python program to implement the Student Management System: i. Each student record consists of 4 fields of information: Student ID, Name, Sex, and Phone Number. ii. Use a dictionary to implement a student record. iii. Use a list to hold all student records. iv. The program displays a menu of 6 choices for the user to choose from: a) Add a student record b) Delete a student record c) Update a student record d) Show all the information in a student record e) Search through all records with a user-supplied key value in a field (e.g., "Sex = F", "Last Name = Wong") and display the records found f) Quit v. Write a function for each of the 5 functionalities: Add, Delete, Update, Show, Search. vi. The format of Student ID is a 10-digit number like that of CUHK. vii. Name consists of two parts: First name and Last Name. viii. Sex is either "M" or "F". ix. Phone number is an 8-digit number. x. Check the validity of all inputs. xi. Make the program user-friendly and robust; that is, display appropriate error messages to the user instead of program interrupting or crashing.

Write a Python program to implement the Student Management System: i. Each student record consists of 4 fields of information: Student ID, Name, Sex, and Phone Number. ii. Use a dictionary to implement a student record. iii. Use a list to hold all student records. iv. The program displays a menu of 6 choices for the user to choose from: a) Add a student record b) Delete a student record c) Update a student record d) Show all the information in a student record e) Search through al

Read More

Write a Python program to implement the Code Cracking Game i The program randomly generates a 5

Write a Python program to implement the Code Cracking Game: i. The program randomly generates a 5-digit code with each digit being 0-9 without repetition. (Hint: Use the function randint().) ii. This secret code is always hidden from the user. iii. The user keeps guessing the secret code by entering 5 digits until she guesses the code correctly. iv. After each guessing, the program gives a hint to the user, which is constructed in the following way: if the user guesses both the digit and its position correctly then she gets one "P"; if she guesses only the digit correctly but not its position then she gets one "D". The hint is written in the form of "mPnD", where m and n are the total number of P's and D's, respectively, the user gets. For example, suppose the secret code is "03491" and the user's guess is "23974". Then the hint is "1P2D".

Write a Python program to implement the Code Cracking Game: i. The program randomly generates a 5-digit code with each digit being 0-9 without repetition. (Hint: Use the function randint().) ii. This secret code is always hidden from the user. iii. The user keeps guessing the secret code by entering 5 digits until she guesses the code correctly. iv. After each guessing, the program gives a hint to the user, which is constructed in the following way: if the user guesses both the digit and its pos

Read More

1publicclassPremiumSugarSmashPlayer2345 Define the PremiumSugarSmashPlayer class here public

The developers of a free online game named Sugar Smash have asked you to develop a class named SugarSmashPlayer that holds data about a single player. The class contains the following fields:idNumber - the player’s ID number (of type int)name - the player's screen name (of type String)scores - an array of integers that stores the highest score achieved in each of 10 game levelsInclude get and set methods for each field. The get method for scores should require the game level to retrieve the score for. The set method for scores should require two parameters—one that represents the score achieved and one that represents the game level to be retrieved or assigned.Display an error message if the user attempts to assign or retrieve a score from a level that is out of range for the array of scores. Additionally, no level except the first one should be set unless the user has earned at least 100 points at each previous level. If a user tries to set a score for a level that is not yet available, issue an error message.Create a class named PremiumSugarSmashPlayer that descends from SugarSmashPlayer. This class is instantiated when a user pays $2.99 to have access to 40 additional levels of play. As in the free version of the game, a user cannot set a score for a level unless the user has earned at least 100 points at all previous levels.

The developers of a free online game named Sugar Smash have asked you to develop a class named SugarSmashPlayer that holds data about a single player. The class contains the following fields:idNumber – the player’s ID number (of type int)name – the player’s screen name (of type String)scores – an array of integers that stores the highest score achieved in each of 10 game levelsInclude get and set methods for each field. The get method for scores should require the game level to retrieve the scor

Read More

63 Consider the Employee class hierarchy from the beginning of Chapter 6 Use the Template Method

6.3 Consider the Employee class hierarchy from the beginning of Chapter 6. Use the Template Method design pattern to implement a Template Method for the Employee class: String toJson() {} that generates a JSON string with the employee's name, base salary (the salary field), and the total salary (as returned by getSalary()). Example: Employee sarah = new Employee("Sarah"); sarah.setSalary(50000); Manager sandy = new Manager("Sandy"); sandy.setSalary(100000); sandy.setBonus(1234); System.out.println(sarah.toJson()); // prints {"class":"Employee", "name":"Sarah", "salary": 50000} System.out.println(sandy.toJson()); // prints {"class": "Manager", "name": "Sandy", "salary": 101234, "bonus":1234} a) Describe the mappings (table) from the pattern context to the Employee problem domain. b) Show the UML class diagram. The diagram needs to describe the relationship between the base class Employee and subclass Manager. Include attributes and methods involved in implementing the method toJson(). c) Write the Java code for classes Employee and Manager. Include a main() method in class Manager where you illustrate how toJson() is used for objects of both classes.

6.3 Consider the Employee class hierarchy from the beginning of Chapter 6. Use the Template Method design pattern to implement a Template Method for the Employee class: String toJson() {} that generates a JSON string with the employee’s name, base salary (the salary field), and the total salary (as returned by getSalary()). Example: Employee sarah = new Employee(“Sarah”); sarah.setSalary(50000); Manager sandy = new Manager(“Sandy”); sandy.setSalary(100000); sandy.setBonus(1234); System.out.print

Read More

CSC 1501 Assignment 9 Set Theory Due 103020 at the End of Day Assignment Create a program

CSC 1501 - Assignment 9 Set Theory (Due: 10/30/20 at the End of Day) Assignment: Create a program which is capable of assembling and displaying various sets I will provide you with. The program must correctly display the result of operators on sets (such as Union and Intersection), and in addition it must do the following two things: First, it must NOT repeat any values that might appear more than once. So, if you Union two sets together that each have the number '5' somewhere in them, then '5' should only appear ONCE in the resulting set. Second, if the resulting set is empty, your program must indicate the empty set in some recognizable manner, such as displaying "Empty Set" or "E" or something similar. Below are the sets you will use. Also assume that the set A comprises 'reality' so to speak, the numbers 1-10 being all elements possible, such that the INVERSE of A is the empty set. Thus if you were asked to compute the INVERSE of B, it would be equivalent to saying "Set A minus Set B". For this exercise, we will represent inverse with the symbol "!". (100 pts total: 60 for program, 5 per problem) A={1,2,3,4,5,6,7,8,9,10} B={2,4,6,8,10} C={1,3,5,7,9} D={1,2,3,5,7} Problem 1.) A ∩ D Problem 2.) (B ∪ C) ∩ A Problem 3.) !(C ∪ C) ∩ A Problem 4.) A - D Problem 5.) |!(A ∪ (∪ C D))| Problem 6.) D ∪ C Problem 7.) |!(B ∪ C)| Problem 8.) |A ∪ B ∪ C ∪ D| A reminder, |S| indicates the size of the resulting set. So if you have a set such as A={1,3,7,10}, then |A|=4. For problems asking for |S|, your result should be a single number indicating the resulting set's size. Finally, a basic hint to help with this assignment: You may find arrays to be useful.

CSC 1501 – Assignment 9 Set Theory (Due: 10/30/20 at the End of Day) Assignment: Create a program which is capable of assembling and displaying various sets I will provide you with. The program must correctly display the result of operators on sets (such as Union and Intersection), and in addition it must do the following two things: First, it must NOT repeat any values that might appear more than once. So, if you Union two sets together that each have the number ‘5’ somewhere in them, then ‘5’

Read More

719 LAB Multiplications and divisions using shift operations bitwise operations Shifting a

7.19 LAB: Multiplications and divisions using shift operations bitwise operations Shifting a positive integer left by i bits gives the same result as multiplying the same integer by 2i. N2i = N << i Likewise, shifting a positive integer right by i bits gives the same result as dividing the same integer by 2i. N2i = N >> i Given an integer N stored at memory address 5000, write a program that stores the result of N8 at memory address 5004 and the result of N/16 at memory address 5008. Use the '+' button under the Memory display to initialize the memory at address 5000. Ex: If the content at memory address 5000 is initialized in the simulator as 64, the data memory will contain: Note: Shift-right performs an integer division; therefore, digits after the decimal point are ignored.

7.19 LAB: Multiplications and divisions using shift operations bitwise operations Shifting a positive integer left by i bits gives the same result as multiplying the same integer by 2i. N2i = N > i Given an integer N stored at memory address 5000, write a program that stores the result of N8 at memory address 5004 and the result of N/16 at memory address 5008. Use the ‘+’

Read More