** 12.20 (Remove package statement) Suppose you have Java source files under the direc- tories chapter1, chapter2,....chapter34. Write a program to remove the Solve Sotveby Java Programming Exercises 517 statement package chapteri; in the first line for cach Java source file under the directory chapteri. Suppose chapter1, chapter2,.. . . chapter34 are under the root directory srcRootDirectory. The root directory and chapteri directory may contain other folders and files. Use the following command to run the program: java Exercise12 20 srcRootDirectory
Q: 5.3) Write a C++ program to replace all 3-digit numbers in the array given below with a random…
A:
Q: Q3 Let U = {5, 6 }, write an equivalent to the following assertions: 3x P ( x ) v - Vx Q ( x ) Q4.…
A:
Q: 11. Write code that reproduces the output shown below. In [11]: # Code Here In [12]: # DON'T WRITE…
A: In this question we have to write a python code to generate a array using numpy. Question 11. Write…
Q: Convert to binary - methods Write a program that takes in a positive integer as input, and outputs a…
A: import java.util.Scanner; public class LabProgram // the class { // user define…
Q: 17. Write a memory map for the following code. Show all values at the end of execu tion of the…
A: Memory mapping is an interaction or order in PC programming that demands that documents, code, or…
Q: 7. Use a property to give a description of each of the following sets { a, e, i,o,u} {2,4,6,8,10 }
A: Set is the collection of distinct elements In set no same element in the set . Set example…
Q: 28.1 program Write a function void reverse(int a[ ], int size) to reverse the elements in array a,…
A: I give the code in C along with output and code screenshot
Q: QUESTION 23 Given int *ptr, x[6]={11, 238, 4, -70, 9, -53); What the following statement does?…
A: The given code: *(x+3)=12
Q: From a Given Line of Text) Write a program that inputs a line of text and a given word. The program…
A:
Q: 8. Implement a two-dimensional grid with a one-dimensional array. a) Implement an empty array of…
A: Program plan: Declaring the essential headers and the main function. Inside the main function,…
Q: 5) int x; x=10,20,30; cout<<x<<endl;
A: Coded using C++.
Q: 18 - What is the output of the following code?
A: The output of the following code is - Good Luck good luck
Q: 4. Consider the following declaration. int list[] = {3, 8, 10, 13, 6, 11}; a. Write a C++ code that…
A: please do upvote for my efforts thanks! answer: a) #include <bits/stdc++.h>using namespace…
Q: HW5-4) Write and test a function that fetches the next n characters from input (including blanks,…
A: Answer
Q: .13 Define a method named swapValues that takes an array of four integers as a parameter, swaps…
A: Java code to swap elements at index 0 and 1, 2, and 3 are given below with an output. Algorithm:…
Q: What is the list created by the following Python statements? 1s = list(range(10, 21, 5))…
A: Please find the solution in the below step
Q: 8.15 (Displaying a Sentence with Its Words Reversed) Write a program that inputs a line of text,…
A: Let us consider a C program that inputs a line of text, tokenizes the line with function strtok and…
Q: Q4: Write a program to sort the following list of numbers ascendingly. L=[15,6,8,19,10,17,7,22,5,14]
A: As you have not mentioned the coding language i am providing the solution in java: Code: public…
Q: 6. Write a C++ program to check whether the sequence of the numbers in a given array is a…
A: I give the code in c++ along with output screenshot and code screenshot
Q: Q: (10 mark) Write a cod program to creat and print the array A(4,4), which all elements equal zero…
A: Cod program can be used in a window-based, web-based, or console application. To start with, we will…
Q: Define a method named swapValues that takes an array of four integers as a parameter, swaps array…
A: import java.util.Scanner; public class LabProgram { public static void swapValues(int[]…
Q: D Construct DEA 0ver Ź ={9,66starte and Ende Lith same Aymbel,
A: Given, Input alphabet, Σ={a, b} So the Language L = {a, b, aa, bb, aba, bab, ababa, aabba,…
Q: 8- Using the following declaration: int [,] x = {{12, 13, 14, 15}, {16, 17, 18, 19}}; What does x…
A: 2-d arrays in C# are declared asint [,]x = {{1,2,3},{4,5,6},{7,8}}
Q: I am having trouble with these 2 review questions for my C++ course. Ex 9: Storing an array into a…
A: Because of our guidelines, we can answer only one question so post other question seperately.
Q: Python 3.7.4 Write a statement that associates d with a one-entry dictionary that maps the str…
A: The required statement is as given below:d = {'answer':42}
Q: 1. Using C++, Implement the following using C++ arrays and Classes. find the Mean, Median, Mode,…
A: According to the information given:- We have to find mean , median, mode, standard deviation and…
Q: public class Turn{public static void main(String[] args){// Different initial values will be used…
A: Equations that are used to replace the value of variable x and y: - The initial values of the…
Q: python) 11. Create a function based on the following information: There is a list which contains…
A: We have to create a function based on the following information as given in the question: Function…
Q: 3. Write C++ statements to define and initialize the following arrays. a. Array heights of 10…
A: array declaration and initialization in c++ syntax is data_type…
Q: Printing array elements separated by commas. Write a for loop to print all NUM_VALS elements of…
A: The given below program is in java
Q: Assume bool foundPair and int pairCount are both declared and have valid values. if (foundPair)…
A: Here foundPair is boolean variable so it can hold either true or false value. The if statement in…
Q: 9.15 Consider the following declaration in C: double(*foo (double (*)(double, double []), double))…
A: According to the asked question, the solution is given below with a proper explanation.
Q: Assuming the following declarations, write C++ expressions to set all integer values of b’s members…
A: Given: //structure A struct A { //structure data m1 int m1[2]; } //structure B struct B { //…
Q: 7.17) Write the inOrder() method, which has an array of integers as a parameter, and returns true…
A: Given: Write the inOrder() method, which has an array of integers as a parameter, and returns true…
Q: Question 3
A: Writing the program code in java as in the given question no programming language is specified.This…
Q: 1. Write a grading prögi a. There are two quizzes, each graded on the basis of 10 points. b. There…
A: “Since you have asked multiple questions, we will solve the first question for you. If you want any…
Q: 14- The following script is used to find the series (g = 1+ e-x+2e-2x + 3e-3x + + 10e-10x) *…
A: The answer is false, because the above mentioned code generates the following error.
Q: 5.28 LAB: Convert to binary - functions Write a program that takes in a positive integer as…
A: Since, here no programming language is specified so, we are providing the solution in the python…
Q: Q5. (a) Write a program to input a list of numbers in an array and then rearrange this array in such…
A: Introduction of the Program: The C program takes the size of the array from the user and then the…
Q: #include #include #include #include #include int main() { int i, s; int a[] =…
A: #include <stdio.h>#include <stdlib.h>#include <unistd.h>#include…
Q: 7.13 LAB: Catalog Publisher When a publisher prepares a document to be published, the text of the…
A: Program in python: import textwrap value = """cosc 380 seminar on the computer profession and…
Q: а1.1. Write a NumPy program to get the following array by using loops Output: array([[ 1, 2, 3, 4,…
A: Note: Answering the first three subparts as per the guidelines. The question is about the usage of…
Q: 18. A former secretary has left her job and decided to sell textbooks. Assume the book is sold at…
A: Given: We are given that former secretary has left her job and she has decided to sell textbooks.…
Q: Write the following sets in Set-Builder Form or Rule form: I) A = {1, 3…
A: When expressing the set in Set-Builder Form or Rule form, instead of listing actual elements of a…
Q: 14- The following script is used to find the series (g = 1+ e-x+2e-2x + 3e-3x + ..• + 10e-10x) *…
A: Task : The task is to check whether the given code implements that series whose value is equal to…
Q: code in C# to perform an update
A: Steps to create the program: Declare an array with the original marks. Iterate over the length of…
Q: n c++ implement function getPercentage that takes two inputs: grade and total Grade and outputs the…
A: So we are going to write a c++ program to print the percentage of student by taking grade and total…
Q: 4. b. If A is an array of integers with width = 4; Please translate with three-address statement,…
A: In 3 address instrument format, one opcode and 3 address field is required.
Step by step
Solved in 2 steps with 2 images
- %१৭ |h solve by Java **12.27 (Replace words) Suppose you have a lot of files in a directory that contain words Exercisei j, where i and j are digits. Write a program that pads a 0 before i if i is a single digit and 0 before j if jis a single digit. For example, the word Exercise2_ in a file will be replaced by Exercise02_01. In Java, when you pass the symbol from the command line, it refers to all files in the direc- tory (see Supplement III.V). Use the following command to run your program: java Exercise12_27 Soe e مشاركة التمرير التقاط 国5.12 Online shopping cart (Java) Create a program using classes that does the following in the zyLabs developer below. For this lab, you will be working with two different class files. To switch files, look for where it says "Current File" at the top of the developer window. Click the current file name, then select the file you need. (1) Create two files to submit: ItemToPurchase.java - Class definition ShoppingCartPrinter.java - Contains main() method Build the ItemToPurchase class with the following specifications: Private fields String itemName - Initialized in default constructor to "none" int itemPrice - Initialized in default constructor to 0 int itemQuantity - Initialized in default constructor to 0 Default constructor Public member methods (mutators & accessors) setName() & getName() (2 pts) setPrice() & getPrice() (2 pts) setQuantity() & getQuantity() (2 pts) (2) In main(), prompt the user for two items and create two objects of the…5.12 Online shopping cart (Java) Create a program using classes that does the following in the zyLabs developer below. For this lab, you will be working with two different class files. To switch files, look for where it says "Current File" at the top of the developer window. Click the current file name, then select the file you need. (1) Create two files to submit: ItemToPurchase.java - Class definition ShoppingCartPrinter.java - Contains main() method Build the ItemToPurchase class with the following specifications: Private fields String itemName - Initialized in default constructor to "none" int itemPrice - Initialized in default constructor to 0 int itemQuantity - Initialized in default constructor to 0 Default constructor Public member methods (mutators & accessors) setName() & getName() (2 pts) setPrice() & getPrice() (2 pts) setQuantity() & getQuantity() (2 pts) (2) In main(), prompt the user for two items and create two objects of the…
- 5.11 Online shopping cart (Java) Create a program using classes that does the following in the zyLabs developer below. For this lab, you will be working with two different class files. To switch files, look for where it says "Current File" at the top of the developer window. Click the current file name, then select the file you need. (1) Create two files to submit: ItemToPurchase.java - Class definition ShoppingCartPrinter.java - Contains main() method Build the ItemToPurchase class with the following specifications: Private fields String itemName - Initialized in default constructor to "none" int itemPrice - Initialized in default constructor to 0 int itemQuantity - Initialized in default constructor to 0 Default constructor Public member methods (mutators & accessors) setName() & getName() (2 pts) setPrice() & getPrice() (2 pts) setQuantity() & getQuantity() (2 pts) (2) In main(), prompt the user for two items and create two objects of the…5.11 Online shopping cart (Java) Create a program using classes that does the following in the zyLabs developer below. For this lab, you will be working with two different class files. To switch files, look for where it says "Current File" at the top of the developer window. Click the current file name, then select the file you need.(1) Create two files to submit: ItemToPurchase.java - Class definition ShoppingCartPrinter.java - Contains main() method Build the ItemToPurchase class with the following specifications: Private fields String itemName - Initialized in default constructor to "none" int itemPrice - Initialized in default constructor to 0 int itemQuantity - Initialized in default constructor to 0 Default constructor Public member methods (mutators & accessors) setName() & getName() (2 pts) setPrice() & getPrice() (2 pts) setQuantity() & getQuantity() (2 pts) (2) In main(), prompt the user for two items and create two objects of the ItemToPurchase…Can you please help solve this, please as fast as possible use ***C++**** 6.20: Word Count (see attached screen print AND input file) Write a program that prompts the user to input the name of a text file and then outputs the number of words in the file. You can consider a "word" to be any text that is surrounded by whitespace (for example, a space, carriage return, newline) or borders the beginning or end of the file.Input Notes:There are two input sources in this program: the text file and standard input. The standard input consists of a single word, the name of the text file to be read. DO NOT USE A STRING VARIABLE.Output Notes (Prompts and Labels): The filename provided in standard input is prompted for with "Enter a file name: " and displayed so that the filename entered is on the same line as the prompt.The output of the program is a single line of the form: "The file contains N words." where N is the number of words determined by the program.
- 9.13 LAB: Thesaurus Python Given a set of text files containing synonyms for different words, complete the main program to output the synonyms for a specific word. Each text file contains synonyms for the word specified in the file’s name, and each row within the file lists the word’s synonyms that begin with the same letter, separated by a space. The program reads a word and a letter from the user and opens the text file associated with the input word. The program then stores the contents of the text file into a dictionary predefined in the program. Finally the program searches the dictionary and outputs all the synonyms that begin with the input letter, one synonym per line, or a message if no synonyms that begin with the input letter are found. Hints: Use the first letter of a synonym as the key when storing the synonym into the dictionary. Assume all letters are in lowercase. Ex: If the input of the program is: educate c the program opens the file educate.txt, which contains:…9.12 LAB: File name change PYTHON A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names. Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output. Ex: If the input of the program is: ParkPhotos.txt and the contents of ParkPhotos.txt are: Acadia2003_photo.jpg AmericanSamoa1989_photo.jpg BlackCanyonoftheGunnison1983_photo.jpg CarlsbadCaverns2010_photo.jpg CraterLake1996_photo.jpg GrandCanyon1996_photo.jpg IndianaDunes1987_photo.jpg LakeClark2009_photo.jpg…14.24 LAB: Drop student Complete the Course class by implementing the drop_student() instance method, which removes a student (by last name) from the course roster. If the student is not found in the course roster, no student should be dropped. The file main.py contains: The main function for testing the program. • Class Course represents a course, which contains a list of Student objects as a course roster. (Type your code in here.) Class Student represents a classroom student, which has three attributes: first name, last name, and GPA. (Hint: get_last() returns the last name field.) ● ● Note: For testing purposes, different student values will be used. Ex. For the following students: Henry Nguyen 3.5 Brenda Stern 2.0 Lynda Robison 3.2 Sonya King 3.9 the output for dropping Stern is: Course size: 4 students. Course size after drop: 3 students
- PARTICIPATION ACTIVITY Consider a file that contains student grades such as the following: Jane Lee Aaron X. Schmidt Frank von Tardy ... 8.5.5: Arrange the code to read one line of input at a time and then scan the line with another scanner. As with the country names, the student names don't have a fixed number of words. To process the input, read one line of input at a time from the given scanner in, then scan the line with another scanner. Add all but the last word from the line to the name, and set the grade to the last word. Mouse: Drag/drop Keyboard: Grab/release spacebar (or Enter). Move 0000. Cancel Esc Unused 100 37 else while (lineScanner.hasNext()) { } { 2 name = name + " " + next; } if (lineScanner.hasNext()) Check String next = lineScanner.next(); String line in.nextLine(); Scanner lineScanner = new Scanner (line); String name = ""; String grade = ""; { arada - nevt. Inn = StudentGrades.java import java.util.Scanner; public class StudentGrades { } Load default template...…9 /11 100% Exercise 1: Write a python program that reads from a text file whose name is provided by the user and including lines relating to the dimensions of three kinds of shapes: Circle, Triangle, Trapezoid (see figure below for a sample input file). For each shape compute and display its area: Triangle area = 2 base X height. → Circle area n radius2. - Trapezoid area = ; (base 1 + base2)X height. 2 Your program should consider the following erroneous cases: • The file does not open/exist • The format of the data in the file is incorrect (e.g. shape name = 'Polygon'), the shape's dimensions are incorrect (e.g. negative value or number of values for a trapezoid not equal to 3: base,, basez and height, or), in which case RuntimeError exception should be raised and the processing should continue. 50 48 Shape Area Triangle: Circle: -10 Triangle Circle 1200.00 Trapezoid: 10 12 70 Trapezoid: >> invalid dimension 770.00 >> missing data. 9 32 Trapezoid Trapezoid Sample input file Sample…12.10 LAB: Sorting TV Shows (dictionaries and lists) Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. The input file contains an unsorted list of number of seasons followed by the corresponding TV show. Your program should put the contents of the input file into a dictionary where the number of seasons are the keys, and a list of TV shows are the values (since multiple shows could have the same number of seasons). Sort the dictionary by key (greatest to least) and output the results to a file named output_keys.txt. Separate multiple TV shows associated with the same key with a semicolon (;), ordering by appearance in the input file. Next, sort the dictionary by values (in reverse alphabetical order), and output the results to a file named output_titles.txt. Ex: If the input is: file1.txt and the contents of file1.txt are: 20 Gunsmoke 30 The Simpsons 10 Will & Grace 14 Dallas 20 Law & Order 12…