What gets printed by executing the following code? def sets() : - {'a','b','c','d'} {'z','a','b','x'} sl s2 %3D s3 = s1 | s2 s4 = sl ^ s2 %3D sl s2 s6 = sl & s2 print (s3) print (s4) print (s5) print(s6) def main () : sets() main () 234 5
Q: Class Gradebook1D Write an application that prints out the final grade of the students in a class…
A: Program: //import the header file import java.util.Scanner; import java.text.DecimalFormat;…
Q: In java language Create a class name FunWithArrays and create the following methods:…
A: public class FunWithArrays{ public static void main(String[] args) { int arr[] =…
Q: suppose the following declaration: int arr1[] new int[10]; int arr2[] = new int [5]; Write a method…
A: Java program to find common element between two array: import java.util.Arrays; public class Main {…
Q: Jordan University of Science and Technology CS415 Contemporary Programming Techniques Midterm Exam –…
A: I have gone through your question and had implemented class with constructore and all the methods…
Q: Edit this code to be Allow to input a double number The code is //AssignmentMarks.java import…
A: Given that Edit this code to be Allow to input a double number The code is //AssignmentMarks.java…
Q: please can this code be converted to c++ or Java. Thank you Code is as follows: location = []…
A: I am converting this python code to c++. In step 2, you will get C++ code.
Q: Write a class ArrayClass, where the main method asks the user to enter the four numbers. Create a…
A: JAVA code: ArrayClass.java import java.util.Arrays;import java.util.Scanner; public class…
Q: ic static int [] generateRandomArr(int length, int sorted){ } first parameter: an non-negative…
A: I have implemented the code below:
Q: template int ternary_search(const ArrayLike& array, const T& value, int low, int high) { // Base…
A: Here we are going to do a ternary search before that first know what is a ternary search? Ternary…
Q: #include struct rec {int a; int b;}; void fun(struct rec*); main() fun: sp->a=5 sp->b=26 main:…
A: Structures are used to store values of different data types. Structure rec contains two variables…
Q: Write two methods countMore Than50 to count numbers more than 5 and display the count to Console -…
A: public class Main{ public static void countMoreThan5(int arr[]) { int len = arr.length;…
Q: Write a java program that prompts the user to enter ten integer values and reads them into an array.…
A: package bartlebey;// Importing the required packagesimport java.io.*;import java.util.*;public class…
Q: include tinclude tinclude typedef atruct 1 int fld; } item t: static int d-100; static void…
A: Here within the given code in C , the malloc function , the pointers and therefore the strdup…
Q: D creates an associative array containing three key-value pairs
A: let town = { name: "Helena", county: "Shelby", population: 18500}; AnsweR : D creates…
Q: Class Gradebook1D Write an application that prints out the final grade of the students in a class…
A: Program code: //import the header file import java.util.Scanner; import java.text.DecimalFormat;…
Q: #pragma once class Student { public: Student(); double calculateAverage(); private: double…
A: Note- As you have asked for implementing calculateAverage() method only and you did not provide…
Q: ****************************Instructions***************************** Add a "copy constructor" to…
A: Objective: Here, a copy constructor requires to be added and some courses would be added to the…
Q: File Welcome to OOPII_PizzaMania Each Topping: $150 Pizza Size Pizza Type O Tomato O small: $25.00…
A:
Q: Consider array fr, which contains 5 friends. Which statements successfully swap the values at index…
A: Refer to step 2 for the answer.
Q: Consider the following code snippet: int sum = 0; int mylist[] = {8, 12, 3, 4, 12, 9, 8}; for (int…
A: The given code snippet is: int sum = 0;int mylist[] = {8 , 12, 3, 4, 12, 9, 8};for (int row = 0; row…
Q: void mysteryFunction(int myList[][5], int r, int c) { int i, j, k, curr, temp; for ( (1) ) for (i =…
A: In the main method, we have a 2dimensional array with 2 rows and 5 columns. Next, we have called the…
Q: 7. Which one should be executed so that the fifth element in Y to be FF if Y is an array of words?…
A: Correct answer of above given question is option (4) mov Y+8, FFh Explanation for correct answer is…
Q: 2. Write a class ArravClass, where the main method asks the user to enter the f num bers. Create a…
A: Java code: import java.util.Scanner;import java.util.Arrays; public class ArrayClass{ public…
Q: 4.4.1: Modify an array parameter. Write a method swapArrayEnds() that swaps the first and last…
A: Write a method swapArrayEnds() that swaps the first and last elements of its array parameter. Ex:…
Q: package com.olympic.cis143.hw1.fizzbuzz; public class FizzBuzzConverter { public int[] data; public…
A: Below is the java code to implement the FizzBuzz game according to the given program: - Explanation…
Q: What is true after the execution of the following code? ArrayList arrayList = new ArrayList();…
A: Given: ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("a");…
Q: Answer in Java. you have an array called inventory with 5 max values constructor looks like: public…
A: Answer: I have done code and also I have attached code and code screenshot as well as output
Q: Assume the following method is added to the ArrayQueue class. What does this method do? public void…
A: 1) This method uses two pointers, front and rear, pointing to first and last element in the…
Q: Write a method that rotates N number of 2-D points by given angle (counter-clockwise). The points…
A: The formula to rotate a point by a given angle is :
Q: What gets printed by executing the following code? def teststrings(): str1 = 'X University' str2 =…
A: If running same code it giving the error due to some mistake using " ' in same statement opening…
Q: ample: ell> var I = new StringI { "hello", "world", "what", "up" } > String[4] { "hello", "world",…
A: import java.util.Arrays; public class TestRotateRight { public static void rotateRight(int[]…
Q: Assume class ArrayStack has been deńned using the implementation in your textbook and that myStack…
A: Answer:-
Q: Please use the information on the first screenshot about a class BST and node class to implement a…
A: import java.util.Random; //this is our class which have data, nleft and right stored…
Q: The average is supposed to come to 17.2 im getting 17?? // Application sums and averages an array…
A: Here I have created a variable named avg of type double. Next, I have added all elements from the…
Q: 1) Write a static method named computeOddSum that is passed an array of int's named numbers. The…
A: SOURCE CODE // NOTE : Save this code as Main.java to compile and execute the program. // Main runner…
Q: JAVA programming language i need to create an "addFront" method in the bottom of the code that…
A: public void addFront(int e) {//add only if there is spaceif (size >=…
Q: Create a console application YourLastNameAlP3SC and use a one-dimensional array to solve the…
A: 1. program1 /******************************************************************************…
Q: 1) What is one main disadvantage of an ArrayList? 2) Write a Java statement to create an ArrayList…
A: Given:
Q: (1) Create an array of String objects and populate it with the days of the week (7 days)(i.e.,…
A: Program code: //import the required packages import java.util.Scanner; //define the class Cafeteria…
Q: A teacher has five students who have taken four tests. The teacher uses the following grading scale…
A: #include <iostream> using namespace std; int main(){ string names[5];char…
Q: Using C# create a console app doing the following Write a method that takes two integers and…
A: Kindly Note: As per our company guidelines we are supposed to answer first 3 sub-parts. Kindly…
Q: by Java I1.14 (Combine two lists) Write a method that returns the union of two array lists of…
A: import java.util.ArrayList;import java.util.Scanner; public class Combine { public static void…
Q: Given the following variable declaration: int* newDimensions; Which assignment statement will…
A: Given variable - int* newDimensions;
Q: te a class called CustomerListerwith a mainmethod that instantiates an array of Stringobjects called…
A: It is defined as programs can be asked from control statements, array, string, oops etc. Java basic…
Q: Consider the following method: Method Body: void insertinArray(int num, int index){ int i;…
A: Modification in the program: Check if the array is sorted. If the array is sorted print that…
Q: (Sum ArrayList) Write the following method that returns the sum of all numbers in an ArrayList:…
A: The given method prototype is below: public static double sum(ArrayList<Double> list) The…
Q: Line, 32 class TestRectangle2{ public static void main(String args]X Rectangle r1=new Rectangle();…
A: Class is a Rectangle that contains private data members' length, width, and length1. insert() method…
Q: (ArrayIndexOutOfBoundsException)Write a program that meets the following requirement Create an…
A: Hey, I have read the question carefully and will be providing you the required solution(code) for…
Q: briefly comment the code #include #include /* ADJACENCY MATRIX int…
A: Given : briefly comment the code :
Q: Write a method that counts the number of all elements that are multiples of the number 2 and not the…
A: Check whether the entered number is a multiple of 2 AND not a multiple of 4 OR has a 2 in it.
In Python:
What gets printed by executing the following code?
Step by step
Solved in 2 steps with 1 images
- In Java Write a program which should be able to store 2 quiz scores for a maximum of 5 students. Your program should declare 3 arrays to store names and two scores for each of the students. Your program should declare methods to add, delete, update information for students. Your program should also allow to print the list of all students with their scores and also it should allow to print students whose average is less than 5. Your main function should have all theses options in a loop. (Hint: For Delete, just set the name to null. While printing, print the values only when name is not null). You need to pass arrays and student data to your functions. Following is a sample run: 1: Add a student record2: Delete a student record3: Update a student record4: Print all student records5: Print all student records who average of quiz is below 5. Enter a number: 1Enter name:JohnEnter Quiz 1 Score :9Enter Quiz 2 Score:10Student Successfully added 1: Add a student record2: Delete a student…please code in python Forbidden concepts: arrays/lists (data structures), recursion, custom classes You have been asked to take a small icon that appears on the screen of a smart telephone and scale it up so it looks bigger on a regular computer screen.The icon will be encoded as characters (x and *) in a 3 x 3 grid as follows: (refer image1 ) Write a program that accepts a positive integer scaling factor and outputs the scaled icon. A scaling factor of k means that each character is replaced by a k X k grid consisting only of that character. Input Specification:The input will be an integer such that 0 < k ≤ 10. Output Specification:The output will be 3k lines, which represent each individual line scaled by a factor of k and repeated k times. A line is scaled by a factor of k by replacing each character in the line with k copies of the character. [refer image2]Create in Java (1) Create an array of String objects and populate it with the days of the week (7 days)(i.e., Monday - Sunday)(2) Create an array parallel to the one created in (1) to store the entrées. However, you do not have this information, soyou will need to write a loop that prompts the user to enter the entrée served on that day. This prompt shouldinclude the day for which you are asking for the information (e.g., "What entrée is being served on Monday?")(3) Create another parallel array that stores the prices. You will also need to collect this information from the user. Thistime, your prompt should include the name of the entrée for which you are asking for the price(4) Prompt the user to choose an entrée from a list that you display numbered 1 through 7 (have them input a number1 to 7) and search the array and output the day on which the entrée will be served(5) Search through the array for the highest price entrée and output the name of this entrée for the user including…
- getEvens public static int getEvens(int[] array, int[] result) Initializes the out parameter result with even values found in array Parameters: array - integer array result - integer array Returns: Number of even values found Throws: java.lang.IllegalArgumentException - if array or result (or both) are null, or if result's length is less than array's length. Any error message is fine (e.g., "Invalid parameters(s)")6.20 LAB: Fibonacci sequence Java? The Fibonacci sequence begins with 0 and then 1 follows. All subsequent values are the sum of the previous two, for example: 0, 1, 1, 2, 3, 5, 8, 13. Complete the fibonacci() method, which has an index, n, as parameter and returns the nth value in the sequence. Any negative index values should return -1.Please Help me asap Please USE PYTHON Implement the design of the Pasta class so that the following output is produced:print("Pasta Plate Count:", Pasta.pasta_plate_count)print("=======================")s1 = Pasta("Chicken")s1.set_ingredients("Farfalle",250, 11, 40, 10)s1.display_all_info()print("------------------------------------")s2 = Pasta("Beef")s2.set_ingredients("Pipe Rigate",150, 10.5, 10, 10)s2.display_all_info()print("------------------------------------")s3 = Pasta("Mushrooms")s3.set_ingredients("Spaghetti",500, 50, 20, 10)s3.display_all_info()print("=======================")print("Pasta Plate Count:", Pasta.pasta_plate_count)Output:Pasta Plate Count: 0=======================Pasta Type: ChickenShape: FarfalleCal: 250 gFat: 11 gProtein: 40 gCarbohydrate: 10 g------------------------------------Pasta Type: BeefShape: Pipe RigateCal: 150 gFat: 10.5 gProtein: 10 gCarbohydrate: 10 g------------------------------------Pasta Type: MushroomsShape: SpaghettiCal: 500 gFat: 50…
- this is my code and the question need to be continued. #include <iostream>using namespace std; class Course{private: string name; string *studentList; int size, capacity=10;public: Course(){ name = "TBD"; size = 0; studentList = new string[capacity]; }Course(string s){ name = s; size = 0; studentList = new string[capacity]; }void setName(string s){ name = s; }getter/accessor for variable name string getName(){ return name; }}; int main(){ Course a, b("Yankee"); cout << a.getName() << endl; a.setName("Mets"); cout << a.getName() << endl; cout << b.getName() << endl; return 0;} this is the Question:: Continue with Team class: a) Copy the previous program to a new file.b) Implement the addMember, removeMember and…(Intro to Java) explain the answers to the below questions using step-by-step explanation. /*** This method is named addFive* It adds 5 to each element stored in an array* @param scores the array of doubles to update * by adding 5 to each element*///write the addFive method herepublic static void main(String[] args) {double[] examScores = {99, 98, 96.5, 94, 91, 88, 85.2, 75.3, 72.1, 70, 69, 62.5, 31};//call the addFive method here with examScores as an argumentSystem.out.println("Updated Scores:\n);for(int i = 0; i < examScores.length; i++) {System.out.print(examScores[i] + " ");}System.out.println();}In Java B. Create class and name it as ArrayOperation. Write the main function In the main function, define array of one dimensional size of 5, of type Sring . The name of the array is StringList. Store the followings values into the array "Information", "Science", "Math", "Data base", "Machine Learning" Create function and name it as The type of function is void, and it has String array of one dimensional. The name of the array is StringArr defined in the function header as formal parameter. UpperCase function should convert all the values of the array to upper case words. Create function and name it as The type of function is void, and it has String array of one dimensional. The name of the array is StringArr defined in the function header as formal. LowerCase function should convert all the values of the array to lower case words. Create function and name it as PrintArray. The type of function is void and it has String array of one dimensional. The name of the array is…
- Please follow the comments and please do exactly according to the comments. import java.util.Scanner; public class SortTemps{public static final int MAX_TEMPS = 1000;// As specified in the directions. public static void main(String[] args){// Temporary arrays to store all the incoming data.int[] temperature = new int[MAX_TEMPS];String[] city = new String[MAX_TEMPS]; int longestCityLength = 0; // Needed to make temperatures line upint count = 0; // Counts actual number of pairs Scanner inScanner = new Scanner(System.in); System.out.println("Enter temperature & city pairs:"); while (inScanner.hasNextInt()){temperature[count] = inScanner.nextInt();city[count] = inScanner.nextLine().trim();if (city[count].length() > longestCityLength){longestCityLength = city[count].length();}count += 1;} // RIGHT AFTER THIS COMMENT declare an instantiate cityTempPairArray// to be an array of length count, holding objects that store the// city/temperature pairs.// HINT: you will have to create…Java class Write a method named minimumValue, which returns the smallest value in an array that is passed (in) as an argument. The method must use Recursion to find the smallest value. Demonstrate the method in a full program, which does not have to be too long regarding the entire code (i.e. program). Write (paste) the Java code in this word file (.docx) that is provided. (You can use additional pages if needed, and make sure your name is on every page in this word doc.) Use the following array to test the method: int[] seriesArray = {-5, -10, +1999, +99, +100, +3, 0, +9, +300, -200, +1, -300} Make sure that the seriesArray only tests for values, which are positive, given your recursive method.Add a print statement at the end of the selectionSort method that prints out the number of swaps that took place during the sort. You should not modify the run() method. Use java. SelectionSort class: import java.util.Arrays; public class SelectionSort extends ConsoleProgram{public void run(){int[] array1 = {9, 8, 7, 6, 5, 4, 3, 2, 1};int[] array2 = {5, 6, 4, 8, 9, 7, 3, 1, 2};System.out.print("First array: ");System.out.println(Arrays.toString(array1));System.out.print("Second array: ");System.out.println(Arrays.toString(array2));System.out.println(); // sort first arrayselectionSort(array1);// sort second arrayselectionSort(array2); System.out.print("First array sorted: ");System.out.println(Arrays.toString(array1));System.out.print("Second array sorted: ");System.out.println(Arrays.toString(array2));}/** Selection sort takes in an array of integers and* returns a sorted array of the same integers.*/public static int[] selectionSort(int[] arr){int currentMinIndex;for (int i = 0; i…