What are the values of today and yesterday after the execution of the following code snippet? int today = today = yesterday % 2; 7, yesterday = 15; 1. 2. %3D 3.
Q: Suppose you change the code in the previous question so that the first line is the following: int…
A: Given: Suppose you change the code in the previous question so that the first line is the…
Q: QUESTION 8 What is the value of x after the call to m1 in line 8 of the following code? public…
A: Given:
Q: Consider the following program: int a- 1; int main(void)H a- al2:0; return n(a); int n(int x) if (x)…
A: The main will return 2.
Q: What is the output of the following program? a b C d 4.0 4.2 It will generate compile-time error. It…
A: Given code: #include<stdio.h>float min(int a,int b,int c){ return…
Q: Q13)What are the output of the following program? #include int main() {…
A: Question 13: The code below has 2 print lines, one is just a basic print line, which prints the…
Q: 13. What is accomplished by the following code? Give a VERY DETAILED explanation. Suggest better…
A: Given data is shown below:
Q: Given the following piece of code : int i=5,sum = 0; while (i<10) { sum-=i; i++; } What is the value…
A: Given code is: int i = 5, sum = 0;while (i < 10){ sum -= i; i++;}
Q: Create a program that will discover all prime numbers up to a specified value.
A: // Java program to display Prime numbers till N class PrimeNo{ //function to check if a given…
Q: What is the result after execution of the following code: int i 1, x 4; while (++i <= 10) { x++:…
A: The output of the given c++ program is discussed below.
Q: When the code below is run, it produces undefined and unpredictable results. Why? Can you suggest an…
A: char *myPtr;myPtr = malloc(10*sizeof(char));for(int i=0;i<10;i++){myPtr[i]='a';} //newly inserted…
Q: Instructions: 1. In the code editor, you are provided with the main() function that asks the user…
A: I have provided C CODE along with CODE SCREENSHOT and TWO OUTPUT…
Q: What are the values of today and yesterday after the execution of the following code snippet? int…
A: The values of today and yesterday are 0,0 respectively.
Q: What would be the output of the following program? def bat(ii): if (ii < 1): return 2 elif (ii < 2):…
A: The Python program has been executed and the output is provided with explanation
Q: Replace (????) with relevant code for the program to function. Details about the programs are…
A: After completing the code, I have provided JAVA CODE along with CODE SCREENSHOT and…
Q: We need to do this same project in Excel VBA but with as many functions instead of subroutines.…
A: Write a program for a calculator using excel VBA.
Q: What is the result of executing the following code? int i = 5; do { i--; } while (i < 0);…
A: For the following code given above which is public class Main{ public static void main(String[]…
Q: Which is the correct statement in the following? for ( int x= 20; x >= 2; x-= 5 ) for (i = 100;…
A: The correct syntax of for loop is: for(initialization; condition; increment/decrement). The given…
Q: Answer: (penalty regime: 10, 20, ... %) RESET ANSWER 1 #include 2 int main(void){ int ctr; for…
A: GIVEN:
Q: Trace the following program and show the output ? #include void main () { const int size =4; int…
A: Given that size = 4 Therefore , for i = 0 r1[0]= 2*0+3 r1= 3 Now r1[3]= 2*3+0= 6 r1[2] = 6
Q: If you are not able to specify the output of the above program exactly, explain why.
A: The sample output of the given program is:
Q: 10. What is the output of the following fragment? for (int i = 0; i <=14; i++) { if (i % 3=2) cout…
A: In this question i started with 0 and goes untill i become 14 print i if i modulo 3 ==2 like 2…
Q: What is the result of executing the following code? int i = 0; while (i >= 2) { System.out.print(i +…
A: ans: No print out
Q: What is wrong in the following code? class A{ public:virtual void f() = 0; };int main() {A a;return…
A: What is wrong in the following code? class A{ public:virtual void f() = 0; };int main() {A a;return…
Q: What value will z have if we execute the following assignment statement? Please elaborate on your…
A: The question states that we have initialised z as 50/ 10.00 . What will the value of z and what is…
Q: Given the following piece of code : int i, sSum = 0; for(i=1;i<7;i++) sum+=2; What is the value of…
A: Code: #include <iostream>using namespace std;int main(){int i,sum=0;//declaring the variables…
Q: What is the value of average after the following code? int x, sum = 0,…
A: The syntax of for loop is for(initialization;condition;increment/decrement) Here the variable x is…
Q: Three employees in a company are up for a special pay increase. You are given a file, say…
A: Program: //include header files #include <iostream> #include<fstream> #include…
Q: Q4What is the output of the given code? Also give explanation [5] #include void mystery(int *ptra,…
A: Given program:
Q: What is the output of the following program segment: C++ int temp[5]; for (int i = 0; i < 5; i++)…
A: Definition of the 1D array: An array is a group of identical data type values together with a name…
Q: Given the following program, what is the scope of i? #include int main (void) { int x = 0; int i =…
A: Given program: #include<studio.h> int main (void) { int x=0;…
Q: Consider the following line of code: X = new int*[n]; What should the type of x be? O int O int* O…
A: Hey there, I am authorised to answer any one question at a time when there are multiple questions…
Q: Int a=2 b=3 What is the result of the following conditions? a<=b a==b !(a==b) (a<=b) && (a==b)…
A: - We need to highlight the value of the provided conditions with the provided values. - The…
Q: What is the result after execution of the following code: int i 1, x 4: while (++i <= 10) { x++:…
A: The given C++ code is executed and the result which is the correct answer is provided with…
Q: What will be the output of following program? #include int main() { int i, j = 3; %3D float k = 7;…
A: % is referred to as the modulo operator. It is used to find out the remainder while dividing two…
Q: 1. What is the output of the following code? char symbol[3] = {'a', 'b', 'c'}; for (int index = 0;…
A: 1) OUTPUT OF CODE: abc SCREENSHOT:
Q: Consider the code snippet below, what is the value of b[1]? int a[5)-10,1,2,3,4): int "b=&a[1];
A: The value of b[1] will be 2.
Q: What problem arises in running the following program? How do you fix it?class A:def _ _init_ _(self,…
A: Step 1:- Program:- class A:def _ _init_ _(self, i = 0):self.i = iclass B(A):def _ _init_ _(self, j =…
Q: public void {
A: It will perform a push() with pop as the costlier operation
Q: Consider the following snippet of code? double interestOnLoan 19.35; double loanAmount…
A: Here we are two doubles values and assigning to int value
Q: 1. Is the following code correct? Give reasons for your answer. int bigger(int p1, int p2) { return…
A: Yes the code is correct Basically bigger function takes two integer and return the greater integer…
Q: Describe two ways on how you could modify the following code snippet so there will not be an…
A: The Java for loop is used to repeatedly iterate a part(portion) of the program. The for loop is…
Q: What is the output from the following code? Truck mycar = new Truck(); System.out.println(mycar);…
A: To inherit one class from other, we have to use extends keyword when declaring the child class…
Q: Assuming the code x = 3 % 4 - 2 * 5 / 6 * (3 * 2 – 1); has been executed correctly, what is the…
A: Introduction: Here we are asked what will be the value of x which have a equation given above.
Q: the output of the following ?
A: matlab mean(a+b); //code for Matlab functions mean = mean(a+b) Num = input('Enter the array of…
Q: Q2. Answer the following 1. What is the output run of the following code? > p=[0 1]; > q=[1-1 0]; >…
A: NOTE: As per company guidelines we are only supposed to answer first 3 subparts kindly post another…
java
Step by step
Solved in 2 steps
- Consider the following snippet of code? double interestOnLoan 19.35; double loanAmount = 100.25; int totalAmount = 0; totalAmount = (loanAmount + interestOnLoan); What is the final totalAmount equal to?Will the following code compile, and if not, which line or lines will cause a compile error? Line 1: public void myMethod() {Line 2: int sum = 0;Line 3: while (i<3) { Line 4: sum += i;Line 5: System.out.println("i = " + (i++));Line 6: }Line 7: System.out.println(sum);Line 8: } 1. Line 6 has an error. 2. Lines 3, 4, and 5 have errors. 3. Line 1 has an error. 4. There are no compile errors - it will compile correctly. 5. Line 4 and 7 have errorsIn Java Provide a complete program that handles the entry and display of homework scores. As part ofyour program, provide a HwScore class that contains the points earned on a particular homeworkand also the maximum possible points on that homework. In order to keep track of the overallaverage, the HwScore class also contains the total points earned on all homework combined andthe total possible points on all homework combined. In order to determine letter grades, theHwScore class specifies cutoff values for the A, B, C, and D letter grades.More specifically, the HwScore class should contain these constants and variables:• Named constants for the letter grade cutoffs: A = 0.9, B = 0.8, C = 0.7, D = 0.6• Class variables named totalEarnedPoints and totalPossiblePoints• Instance variables named earnedPoints and possiblePointsThe HwScore class should contain a two-parameter constructor that handles initializations forthe earnedPoints and possiblePoints instance variables.Implement a…
- Maclaurin series are a type of Mathematic series expansion in which all terms are nonnegative real powers of the variable. The Maclaurin series expansion for ???(?) is given by the following formulathat is valid for all real values of x such that x is in radians (Note that: ???????(?) = ? × ?/180): Implement a Java program to compute the value of Maclaurin series expansion for sin(x) where x is a nonnegative real value according to the following: Write a java method named Factorial that takes as an argument an integer value ? and returns the mathematical factorial ?! of ? as a long value such that: n! = n * (n-1) * (n-2) * ........*2 *1 Sample run:Enter an angle in degrees: 30Enter number of terms of maclaurin series: 5Sum of first 5 terms of Maclaurin sries of sin(30) is 0.500000.Math.sin(5) is 0.500000Math.sin(30) - Maclaurin series = 0.000000What is the value of the following expressions (or ERROR)?1. __________ s.length()2. __________ t.length()3. __________ 1 + a4. __________ a.toUpperCase()5. __________ "Tomorrow".indexOf("r")6. __________ "Tomorrow".lastIndexOf('o')7. __________ "Tomorrow".substring(2,4)8. __________ (a.length() + a).startsWith("a")9. __________ s = = a10. __________ a.substring(1,3).equals("bc")please put comments on these line of codes of what these do: private static void evenNumbersAboveDiagonal(int[][] arr) {for(int j=1;j<5;j++){for(int i=j-1;i>=0;i--){if(arr[i][j]%2 == 0)System.out.print(arr[i][j] + " ");}}System.out.println();}private static void oddNumbersBelowDiagonal(int[][] arr) {for(int i=0;i<5;i++){for(int j=0;i>j;j++){if(arr[i][j]%2==1)System.out.print(arr[i][j] + " ");}}System.out.println();}private static int sumOfElementsAboveDiagonal(int[][] arr) {int sum = 0;for (int j=1;j<5;j++) {for (int i=j-1;i>=0;i--) {sum += arr[i][j];}}return sum;}private static int sumOfElementsBelowDiagonal(int[][] arr) {int sum = 0;for(int i=0;i<5;i++){for(int j=0;i>j;j++) {sum += arr[i][j];}}return sum;}private static void elementsOfMainDiagonal(int[][] arr) {for (int i=0;i<5;i++) {for (int j=0; j<5;j++) {if(i == j)System.out.print(arr[i][j] + " ");}}System.out.println();}private static int sumOfPrime(int[][] arr) {int sum = 0;for(int…
- Validate that the following code, which adds themethods var() and stddev() to Accumulator, computes both the mean and varianceof the numbers presented as arguments to addDataValue():public class Accumulator{ private double m; private double s; private int N; public void addDataValue(double x) { N++; s = s + 1.0 * (N-1) / N * (x - m) * (x - m); m = m + (x - m) / N; } public double mean() { return m; } public double var() { return s/(N - 1); } public double stddev() { return Math.sqrt(this.var()); }}This implementation is less susceptible to roundoff error than the straightforward implementation based on saving the sum of the squares of the numberKindly do this in Java ProgrammingKindly show screen captures of your work.please dont respond to this in the event that you can't answer both since I posted a ton of times as of now (programmed pointless) 11. Compose a settled for circle explanation to print out the increase table for numbers 1, 2, .., 9. The result should seems to be: 1 x 1 = 1, 1 x 2 = 2, 1 x 3 = 3, 1 x 4 = 4, 1 x 5 = 5, 1 x 6 = 6, 1 x 7 = 7, 1 x 8 = 8, 1 x 9 = 9 2 x 2 = 4, 2 x 3 = 6, .................................................................................., 2 x 9 = 18 3 x 3 = 9, .................................................................................., 3 x 9 = 27 .................................................................................................... 9 x 9 = 81 (Answer: Use System.out.printf to get sections arrangement overall quite slick) 12. Compose a technique public static initializeArray(int [] arr) to instate a given int cluster named arr with irregular numbers somewhere in the…Validate that the following code, which adds the methods var() and stddev() to Accumulator, computes both the mean and variance of the numbers presented as arguments to addDataValue(): public class Accumulator{ private double m; private double s; private int N; public void addDataValue(double x) { N++; s = s + 1.0 * (N-1) / N * (x - m) * (x - m); m = m + (x - m) / N; } public double mean() { return m; } public double var() { return s/(N - 1); } public double stddev() { return Math.sqrt(this.var()); }} This implementation is less susceptible to roundoff error than the straightforward implementation based on saving the sum of the squares of the numbers.
- My code here is in Python and the goal is to create a BankApp where the user is suppose to enter their username and password and its suppose to show the balance but I forgot to add the information that is suppose to be implemented in my code as shown below. userName passWord Balance========================Mike sorat1237# 350Jane para432@4 400Steve asora8731% 500 Its also suppose to do down the following. Type D to deposit moneyType W to withdraw moneyType B to display BalanceType C to change user, display user nameType A to add new clientType E to exit My Code def read_user_information(): usernames = [] passwords = [] balances = [] try: with open("UserInformation.txt", "r") as file: lines = file.readlines() for line in lines[2:]: data = line.strip().split() usernames.append(data[0]) passwords.append(data[1])…Can you just give a comment in short on what is this about . Or just give a comment on how dose it run. #include #define MAX_EMP 5 #include "employee.h" int count = 0; struct Employee emp[MAX_EMP]; void display() { printf("\n---=== EMPLOYEE DATA ===---\n"); printf("EMP ID\tEMP AGE\tEMP SALARY\n"); printf("======\t=======\t==========\n"); for(int i = 0; i < count; i++) { printf("%d\t%d\t%.2f\n", emp[i].id, emp[i].age, emp[i].salary); } } void add() { if(count == MAX_EMP) { printf("\nERROR!!! Maximum Number of Employees Reached\n"); return; } printf("\nAdding Employee ===============\n"); printf("Enter Employee ID: "); scanf("%d", &emp[count].id); printf("Enter Employee Age: "); scanf("%d", &emp[count].age); printf("Enter Employee Salary: "); scanf("%f", &emp[count].salary); count++; } void update() { int id, found = 0; float newSalary; printf("\nUpdate Employee Salary…hello, i cant get the expected output. below is my code #include<stdio.h>typedef struct { int age; char gender;} Person; void displayPerson(Person); int main(void) { Person persons[5]; for(int i=0;i<5;i++) { printf("Person #%d\n",i+1); printf("Enter Person's age: "); scanf("%d",&persons[i].age); printf("Enter Person's gender: "); scanf("%c",&persons[i].gender); } for(int i=0;i<5;i++) displayPerson(persons[i]); return 0;} void displayPerson(Person p) { printf("PERSON DETAILS:\n"); printf("Age: %d\n", p.age); printf("Gender: "); if(p.gender == 'M') { printf("Male"); } else { printf("Female"); } } Instructions: In the code editor, you are provided with the definition of a struct Person. This struct needs an integer value for its age and character value for its gender. Furthermore, you are provided with a displayPerson() function which accepts a…