Can an indexed variable be used in the same way as a regular variable?
Q: What are the benefits and drawbacks of using decimal data types?
A: Advantage : -These are able to precisely store decimal values, at least they can store decimal…
Q: (Coding Language C++) Dynamic Programs Hoskins College offers both curriculum and continuing…
A: PART A: PROGRAM: //Header file #include <bits/stdc++.h> //Using namespace using namespace…
Q: Complete the function solveMeFirst to compute the sum of two integers. In javascript
A: Algorithm: Start Read 2 numbers a and b Implement a method named solveMeFirst() that takes 2…
Q: Is it possible to have a recursive inline function?
A: Question. Is it possible to have a recursive inline function? Answer. Although you can call an…
Q: get_digits Function: Input variables: • a scalar representing the integer to be studied Output…
A: We have to write a function to get the digits of a number from last to first and also tell whether…
Q: Data can be _
A: Data is of two type - Analog Data- In the form of audio/voice, video/image. continuous signal…
Q: What is the difference between call by reference and call by value when it comes to Memory usage…
A: There are two methodology found in the programming language to call a function: - Call by value…
Q: The pointer variable is defined with: & operator % operator * operator. None of the answers are…
A: Answer:
Q: (True/False) Only existing operators can be overloaded.
A: Operation defined for the operator, so if user defines a function for an operator then that is…
Q: 4. Recursively Multiply Write a recursive function that multiplies its two integer arguments (x and…
A:
Q: A pointer of type int can be used to refer to a variable of type double O False True
A: 1)True. Types of Inheritance:- Single inheritance Multi-level inheritance Multiple…
Q: 305. A program that runs in parts on several computers is said to be a. delegated b. spread c.…
A: Recursive means calling itself so, this is not correct
Q: creat a program using c++ with 2 functions . 1 calculator function that take operend and…
A: public class Test { public int void sum(int a, int b) { int c= a+b; return c; } public static void…
Q: Describe how static variables are represented by their syntax.
A: Static variables are a special kind of variables present in object oriented programming languages.
Q: Defining an initial value has no real advantage over just assigning a value to an existing variable.
A: Introduction: Variables store data such as numbers and words, whereas operators are symbols that…
Q: True or FalseReference variables can be used only to reference objects.
A: The answer is false.
Q: Type *name; is a declaration syntax of a reference O True O False
A: Answer in step 2
Q: One of the disadvantages of Dynamic programming is that it is less efficient on space (memory used)…
A: A) true Explanation It takes a lot of memory to store the calculated result of every subproblem…
Q: In C++ ______ operator is used while declaring references.
A: Answer of the given question: In C++ & operator is used while declaring references. & is…
Q: Are variables well suited for processing lists of data? Why or why not?
A: Answer: “No”, the variables are not well suited for processing list of data because,
Q: Write a word problem that corresponds to the following model for subtraction Missing addend
A: Explanation: An addend is indeed an integer that is appended to some other number, and it is…
Q: 4. Recursively Multiply (20 points) Write a recursive function that multiplies its two integer…
A: As per our guidelines we are supposed to answer only one question. Kindly repost other questions as…
Q: Variables are well-suited to the processing of data lists. True or False
A: Variables are well-suited to the processing of data lists. True or False
Q: Write a function in Swift programming language that takes an integer array as parameters and returns…
A: Write a function in Swift programming language that takes an integer array as parameters and returns…
Q: Q3) Enter this matrix and find and display the results on the command window in Matlab: [2 ET S = C…
A: Since E, C and G are not mentioned, I am assuming the given matrix as character matrix We can find…
Q: Static Variable: a variable whose lifetime is the lifetime of the program (static int x;) Dynamic…
A: Given: Static Variable: a variable whose lifetime is the lifetime of the program (static int x;)…
Q: Write a function in Java. output the following things should be output ask for the members from…
A: //Code in java /* * To change this license header, choose License Headers in Project Properties. *…
Q: A function can return a value of an enumeration type. True False
A: We need to choose if the given statement related to enumeration is true or not. The statement says…
Q: what are indexed variables ?
A: Indexed variables let you stack and align data, eliminating the need to derotate data or to assign…
Q: TRUE FALSE & is used to pass a parameter by value * is used as a reference operator * is called the…
A: & is used to pass a parameter by address. It is also called as reference operator. * Is…
Q: True or False Individual variables are well suited for storing and processing lists of data.
A: Explanation: Every variable is an individual item which should be declared and assigned…
Q: Fundamental types of data, such as strings, integers, and real numbers, are known as __________. a.…
A: Explanation: Primitive data type is the basic data type which is also known as building blocks of…
Q: To what use does having the ability to set a variable's initial value serve?
A: Introduction: There are two types of symbols used in computer programming: variables hold data like…
Q: A tuple may contain objects from user-defined types. Select one: O True O False
A: Tuple is collection of objects in python. The elements in tuple are enclosed by parentheses (). The…
Q: Programming language C++ NB :Make use of pointers to solve the following program
A: //Program to create password and replaceVowels from password and demonstrate each functions in main…
Q: Create a program in C language that calculates the month's day from a given year and year's day. Use…
A: Algorithm: Start Implement a method named month_day() that takes year, yearday,pmonth and pday as…
Q: A variable with ______ scope has storage created for it by a declaration statement located outside…
A: Global Variable: A variable specified outside the subroutine or function is known as a global…
Q: Explain how to manipulate dynamic variables using the new and delete operators.
A: Purpose of new operator: The main purpose of the new operator is to dynamically allocate memory.…
Q: Design a recursive function that accepts an integer argument, n, and prints the number 1 up through
A: Please find the answer below :
Q: 5. Recursively Reverse a List Write a recursive function that reverses a list. For example, given…
A: Using recursive functions reverse a list of array values.
Q: c++ Write the definitions of the functions to implement the operations for the class dayType…
A: dayType.h #ifndef DAY_TYPE_H#define DAY_TYPE_H #include <iostream>#include…
Q: A variable P is called a pointer variable if it: A Contains the address of a data item.
A: ans: A. Contains the address of a data item
Q: It is a type used to represent a heterogeneous collection of data. array function O struct pointer…
A: Array:Array is a bundle of homogeneous objects stored at a contiguous memory locations. The basic…
Q: Write code for tic tac toe in C using 2d arrays and functions. The game is for 2 players User and…
A: CODE : #include <stdio.h>#include <conio.h> char box[10] = { 'o', '1', '2', '3', '4',…
Q: ividual variables are particularly well suited for storing and processing lists of data.
A: Required: Is this statement true or false? Individual variables are particularly well suited for…
Q: What are the benefits of using decimal data types?
A: The benefits of using Decimal data types are
Please answer the question
Step by step
Solved in 2 steps
- Question 2. package sortsearchassigncodeex1; import java.util.Scanner; import java.io.*; // // public class Sortsearchassigncodeex1 { // public static void fillArray(Scanner inputFile, int[] arrIn){ int indx = 0; //Complete code { arrIn[indx] = inputFile.nextInt(); indx++; } }import java.util.Scanner; public class StudentScores { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); final int SCORES_SIZE = 4; int[] lowerScores = new int[SCORES_SIZE]; int i; for (i = 0; i < lowerScores.length; ++i) { lowerScores[i] = scnr.nextInt(); } for (i = 0; i < lowerScores.length; ++i) { System.out.print(lowerScores[i] + " "); } System.out.println(); } }public int getPowerUse(){ return super.getPowerUse() + contents * powerRating; //////////////////////////////////////////////// if (args[0].equals("REFRIGERATOR")) { String manufacturer = args[1]; String serialNo = args[2]; int basePower = Integer.parseInt(args[3]); int powerRating =Integer.parseInt(args[4]); int capacity = Integer.parseInt(args[5]); Refrigerator rf=new Refrigerator(manufacturer,serialNo, basePower, powerRating, capacity); things[rf.getId()]=rf; returnval = rf.getId(); }
- StringFun.java import java.util.Scanner; // Needed for the Scanner class 2 3 /** Add a class comment and @tags 4 5 */ 6 7 public class StringFun { /** * @param args not used 8 9 10 11 12 public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please enter your first name: "); 13 14 15 16 17 18 System.out.print("Please enter your last name: "); 19 20 21 //Output the welcome message with name 22 23 24 //Output the length of the name 25 26 27 //Output the username 28 29 30 //Output the initials 31 32 33 //Find and output the first name with switched characters 34 //All Done! } } 35 36 371- class Excep { 2- public static void main(String[] args){ 3 try{ int arr[]=(1,2}; 4 int x = arr[1]/arr[0]-1; 6 7 catch(ArithmeticException e) 8- { 9. System.out.printin("divide by e"); 10 } 11 catch(ArrayIndexOutofBoundsException e) 12- { 13 System.out.println("wrong indexing"); 14 15 finally 16- { 17 System.out.println("Runtime error"); 18 } 19 }} 20 Answer:import java.util.Scanner;public class LabProgram { public static void main(String args[]) { Scanner scnr = new Scanner(System.in); int credits; int seed; GVDie die1, die2; die1 = new GVDie(); die2 = new GVDie(); // Read random seed to support testing (do not alter) seed = scnr.nextInt(); die1.setSeed(seed); // Read starting credits credits = scnr.nextInt(); int rounds = 0; while (credits > 0) { // Step 1: Roll both dice die1.roll(); die2.roll(); int total = die1.getValue() + die2.getValue(); if (total == 7 || total == 11) { // Player wins one credit credits++; // UPDATE - print the dice total here System.out.println("Dice total: " + total); //UPDATE - break the loop and end the round break; } else if (total == 2 ||…
- import java.util.Scanner; public class LabProgram { public static void main(String args[]) { Scanner scnr = new Scanner(System.in); int credits; int seed; GVDie die1, die2; die1 = new GVDie(); die2 = new GVDie(); // Read random seed to support testing (do not alter) seed = scnr.nextInt(); die1.setSeed(seed); // Read starting credits credits = scnr.nextInt(); int rounds = 0; while (credits > 0) { // Step 1: Roll both dice die1.roll(); die2.roll(); int total = die1.getValue() + die2.getValue(); if (total == 7 || total == 11) { // Player wins one credit credits++; } else if (total == 2 || total == 3 || total == 12) { // Player loses one credit credits--; } else { // Set the goal for future rolls int goal = total;…Debugseven3 contain errors fix code with no errors or mistake import java.util.*; public class DebugSeven3 { public static void main(String[] args) { Scanner kb = new Scanner(System.in); String quote, charString; char searchChar; System.out.print("Enter a famous quote >> "); quote = nextLine(); System.out.print("Enter a character to search for >> "); charString = kb.nextInt(); searchChar = charString.charAt(0); System.out.println("index of('" + searchChar + "') is: " + quote.indexOf(searchChar); System.out.println("index.of('a') is: " + quote.indexOf'a'); System.out.println("index.of('x') is: " + quote.indexOf('x')); System.out.println("char.At(5) is: " + quote.charAt(5)); System.out.println("replace('e', '*') is: " + quote.repplace('e', '*')); } } The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and…import java.util.Scanner; public class TriangleArea { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Triangle triangle1 = new Triangle(); Triangle triangle2 = new Triangle(); // TODO: Read and set base and height for triangle1 (use setBase() and setHeight()) // TODO: Read and set base and height for triangle2 (use setBase() and setHeight()) System.out.println("Triangle with smaller area:"); // TODO: Determine smaller triangle (use getArea()) // and output smaller triangle's info (use printInfo()) }} public class Triangle { private double base; private double height; public void setBase(double userBase){ base = userBase; } public void setHeight(double userHeight) { height = userHeight; } public double getArea() { double area = 0.5 * base * height; return area; } public void printInfo() { System.out.printf("Base:…
- ;import java.util.Scanner } public class Task1 ;static Scanner cin=new Scanner(System.in) ;int n } ;System.out.printlIn("Enter n : ") :On=cin.nextInt { ;int list]=new int[n] }0void readData }for(int i=0;iCode example 2-1import java.util.Scanner;public class InvoiceApp {public static void main(String[] args) {Scanner sc = new Scanner(System.in);String choice = “y”;While (choice.equals(“y”)) {System.out.print("Enter subtotal: ");double subtotal = sc.nextDouble();double salesTax = subtotal * .0875;double invoiceTotal = subtotal + salesTax;String message = “Subtotal = ” + subtotal + “\n”+ “ Sales tax = ” + salesTax + “\n”+ “Invoice total = ” + invoiceTotal + “\n\n”System.out.println(message);System.out.print(“Continue? Enter y or n: ”);Choice = sc.next();}}} (Refer to code example 2-1.) If the user enters 100 the first time the while loop is executed, what will the program display at the console? a. Subtotal: 100.0 Sales tax: 8.75 Invoice total: 108.75 b. Subtotal = 100.0 Sales tax = 8.75 Invoice total = 108.75 c. Subtotal = 100.0 Sales tax = 8.75Invoice total = 108.75 d. Subtotal = 100.0 Sales tax = 8.75Invoice total = 108.75Code example 2-1import java.util.Scanner;public class InvoiceApp {public static void main(String[] args) {Scanner sc = new Scanner(System.in);String choice = “y”;While (choice.equals(“y”)) {System.out.print("Enter subtotal: ");double subtotal = sc.nextDouble();double salesTax = subtotal * .0875;double invoiceTotal = subtotal + salesTax;String message = “Subtotal = ” + subtotal + “\n”+ “ Sales tax = ” + salesTax + “\n”+ “Invoice total = ” + invoiceTotal + “\n\n”System.out.println(message);System.out.print(“Continue? Enter y or n: ”);Choice = sc.next();}}}38. (Refer to code example 2-1.) If the user enters “Y” when asked if he/she wants to continue, the application will a. repeat the while loop b. display a blank line, then repeat the while loop c. EndSEE MORE QUESTIONS