Question 4: Write a function buildstr that will receive a character and a positive integer n. It will create and return a cell array with character vectors of increasing lengths, from 1 to the integer n. It will build the character vectors with successive characters in the ASCII encoding. >> buildstr(a,4) ans = aababcabcd Next, run your code and copy the output from the command window to Notepad (or a Word file) and save it as “lab8_output.txt” or “lab8_output.doc” in the “lab8” folder. Please i
Tag: define function
Question 1 9 points Purpose Practice with conditionals practice with variables and good program
Question 1 (9 points): Purpose: Practice with conditionals; practice with variables and good program design. Degree of Difficulty: Moderate For this problem, you will write a program that will allow a user to calculate a letter-based grade, based on a grade percentage. Here is a description of how your program should look and behave: – Initially, display the text “Grade Calculator” and “Average:” on the canvas. – When the user presses a key, show the keys pressed beside “Average:” – When the use
Your program must define and call the following method The return value of getPhoneNumber 0 is the
Your program must define and call the following method. The return value of getPhoneNumber is the phone number associated with the specific contact name. public static String getPhoneNumber(String[] nameArr, String[] phoneNumberArr, String contactName, int arraySize) Hint: Use two arrays: One for the string names, and the other for the string phone numbers. Please note that the input has commas. You would need to deal with the comma using indexOf and substring. Example code snippet: int comma =
A contact list is a place where you can store a specific contact with other associated information
A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings), separated by a comma. That list is followed by a name, and your program should output the phone number associated with that name. Output “None” if name is not foun
Sample output Bankers Algorithm 1 Enter claim graph 2 Request resource 3 Release resource 4
Sample output of the Banker’s Algorithm: – Enter claim graph – Request resource – Release resource – Determine safe sequence – Quit program Enter selection: 1 Enter number of resources: 3 Enter number of units for resources (r0 to r2): 1057 Enter number of processes: 5 Enter maximum number of units process p0 will claim from each resource (r0 to r2): 753 Enter maximum number of units process p1 will claim from each resource (r0 to r2): 322 Enter maximum number of units process p2 will claim from
53 Write a program that displays editable bar graphs The GUI has two horizontal panels The right
5.3. Write a program that displays editable bar graphs. The GUI has two horizontal panels. The right panel contains textfields with numbers. The left panel contains corresponding horizontal bar graphs that graphically show the value of the numbers on the left. Use a rectangle with the width (in pixels) equal to the numbers from the textfield, but no higher than 100 pixels. The UI should look something like this: Use MVC and the Observer pattern. Store the numbers in the model. Attach the
Between a Rock and a Hard Place Given a string in a variable named text write code that finds the
Between a Rock and a Hard Place Given a string in a variable named text, write code that finds the substring that lies between the substring ‘rock’ and the substring ‘hard place’. For example, if text contains ‘here is a rock and here is a hard place’, then the result would be ‘ and here is a’. Assign the result to a variable named between. Assume that text already has a value that contains the substrings ‘rock’ and ‘hard place’ in that order. Print the Longer String Write code that prints the