Consider the following situations:
In: Computer Science
Every time I run this code I get two errors. It's wrote in C# and I can't figure out what I'm missing or why it's not running properly. These are two separate classes but are for the same project.
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RecursiveMethod
{
class Program
{
static bool ordering = true;
static string str;
static int quantity = 0;
static string Invoic = string.Empty;
static double itemPrice;
static double totalCost = 0;
static void Main(string[] args)
{
int menuOption;
int Item = 0;
Console.WriteLine("Enter your FirstName"); //First Name
string sFirstName = Console.ReadLine();
Console.WriteLine("Enter your LastName"); //Last Name
string sLastName = Console.ReadLine();
Console.WriteLine("Enter your ID"); //Last Name
string sStudentID = Console.ReadLine();
str = sFirstName + sLastName;
//Call this methos to show student info staring of the programm
displayStudentInfo(str,sStudentID);
//display your message function
displayMessage(str);
string invoice = string.Empty;
while (ordering)
{
Console.WriteLine("Enter your item");
menuOption = Convert.ToInt32(Console.ReadLine());
double cost;
switch (menuOption)
{
case 1:
Item = 1;
ProgressLogic.addItem(1, invoice, out Invoic, out quantity,out itemPrice);
invoice = Invoic;
cost = displayTotal(itemPrice, quantity);
break;
case 2:
Item = 2;
ProgressLogic.addItem(2, invoice, out Invoic, out quantity, out itemPrice);
invoice = Invoic;
cost = displayTotal(itemPrice, quantity);
break;
case 0:
done(totalCost, invoice);
Console.ReadLine();
break;
default:
Console.WriteLine("Invalid Option");
break;
}
}
}
/// <summary>
/// Show the Message
/// </summary>
/// <param name="str"></param>
public static void displayMessage(string str)
{
Console.WriteLine("Welcome " + str + " to dave onlines coffee shop");
}
/// <summary>
/// Show the Student Info
/// </summary>
/// <param name="studentFullName"></param>
/// <param name="iStudentID"></param>
public static void displayStudentInfo(string studentFullName, string iStudentID)
{
Console.WriteLine("Welcome " + studentFullName + " Student ID - " + iStudentID);
Console.WriteLine("Please choose the following Products code. Enter 0 to Exit");
Console.WriteLine("Product 1 kona bled -> $14.95");
Console.WriteLine("Product 2 cafe verona -> $9.95");
}
/// <summary>
/// Done Method to show the information based on the total cost calculations
/// </summary>
/// <param name="totalCost"></param>
public static void done(double totalCost, string strInvoice)
{
ordering = false;
Console.WriteLine("Customer Name");
Console.WriteLine("\n"+ strInvoice);
Console.WriteLine("\n"+"Total Cost"+ totalCost + "$");
}
/// <summary>
/// Disaply the total cost
/// </summary>
/// <param name="itemPrice"></param>
/// <param name="quant"></param>
/// <returns></returns>
public static double displayTotal(double itemPrice, double quant)
{
double cost = (itemPrice * quant);
totalCost += cost;
return totalCost;
}
}
}
using Microsoft.SqlServer.Server;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RecursiveMethod
{
public class ProgressLogic
{
//This method will do the programming logic and will return the calculations in the out parameter
public static double addItem(int item, string oldInvoiceString, out string Invoice, out int quantity, out double itemPrice) {
//we need to initialize the out parameters first so definitily it will some value instead of nothig
//ow it will show error
Invoice = "";
quantity = 0;
itemPrice = 00.00;
if (item == 1) {
itemPrice = 14.95;
Console.WriteLine("Enter Quantity"); //Last Name
quantity = Convert.ToInt32( Console.ReadLine());
Invoice = oldInvoiceString + " Product 1 kona Blend -> $" + itemPrice + " * " + quantity + " = " + itemPrice * quantity + "\n";
}
if (item == 2)
{
itemPrice = 9.95;
Console.WriteLine("Enter Quantity"); //Last Name
quantity = Convert.ToInt32(Console.ReadLine());
Invoice = oldInvoiceString + "Product 2 cafe verona-> $" + itemPrice + " * " + quantity + " = " + itemPrice * quantity + "\n";
}
return itemPrice;
}
}
}In: Computer Science
In 4-5 paragraphs describe “rooting”. Is rooting forensically sound? Why or why not? Are you allowed to root tablets? Why or why not?
Provide scholarly examples or articles that discuss rooting in forensics or cybersecurity.
In: Computer Science
Assingment: for c++
A magic square is an n x n matrix in which each of the integers 1, 2, 3...n2 appears exactly once and all column sums, row sums, and diagonal sums are equal. For example, the attached table shows the values for a 5 x 5 magic square in which all the rows, columns, and diagonals add up to 65.
The following is a procedure for constructing an n x n magic square for any odd integer n. Place 1 in the middle of the top row. Then, after integer k has been placed, move up one row and one column to the right to place the next integer k+1 unless one of the following occurs:
-If the move takes you above the top row in the jth column, move to the bottom of the jth column and place k+1 there.
-If the move takes you outside to the right of the square in the ith row, place k+1 in the ith row on the left side.
-If the move takes you to an already filled square or if you move out of the square at the upper right-hand corner, place k+1 immediately below k.
Write a program to create a magic square. Get the size of the square (an odd integer) from the user. You must use a static matrix for the magic square. A solution using a dynamic matrix is unacceptable.
My code works, but the diagonals do not work, any help would be great, with documentation.
Here's my code:
#include
#include
using namespace std;
int main()
{
int n; //variable for array size (n x n)
cout<< "Enter an odd integer less than 50: ";
cin>>n;
int MagicSq[50][50];
// Clears the array of any unwanted data
for(int x = 0; x < n; x++)
{
for(int y = 0; y < n; y++)
{
MagicSq[x][y] = 0;
}
}
// the variables being used for the arrays
int Row,
Col;
int x =0 ;
int y= n / 2;
// Filling in each element of the array using the magic
array
for ( int value = 1; value <= n*n; value++ )
{
MagicSq[x][y] = value;
// Finding the next cell
Row = (x - 1) % n;
Col = (y + 1) % n;
// If the cell is empty
if ( MagicSq[Row][Col] == 0 )
{
x = Row;
y = Col;
}
else
{
// The cell is full, so use the cell above the previous one.
x = (x + 1 + n) % n;
}
}
for(int i=0; i {
for(int j=0; j cout << MagicSq[i][j]<<" ";
cout << endl;
}
return(0); //End
}
In: Computer Science
import java.util.Scanner;
import java.text.value;
public class Rectangle
{
public static void main(String[]args){
System.out.println("Find the area of a rectangle");
System.out.println("Find the perimeter of a rectangle");
System.out.println("Enter a number of choice");
}
public static void main(String[]args){
int choice = //the user choice
double value :0 // the value returned from the method
double length; // the length of rectangle
double width;// the width of rectangle
Scanner scan = new Scanner(System.in);
System.out.println("Enter length: ");
double length = scan.nextDouble(); //the length of rectangle
System.out.println("Enter width :");
double width = scan.nextDouble(); //the width of rectangle
double area = length*width; //calculating area
double perimeter = 2*(length+width); //calculating perimeter
System.out.println("Area of rectangle is:" + value);
System.out.println("Perimeter of rectangle is:"+value);
}
}
Please fix this Java program to get output and update it
In: Computer Science
Use rules of inference to show that the hypotheses p → q, r → s, and ¬q ∨ ¬s implies ¬p ∨ ¬r
In: Computer Science
Why am I not able to connect to a site using wifi?
In: Computer Science
Suppose the cable company represents the channels your TV has access to with a 32-bit integer. Each channel from 0 to 31is represented by one bit, where 1 means the channel is enabled and 0 means the channel is disabled. Assume channel 0 is the least significant bit. When you get your cable box, the technician sets the 32-bit code.
// for example, this code enables channels 0, 1, and 2 only intcode= 7;
In cableCompany.c, write code for the following tasks. You may not call any “magic” library functions and you may not use any loops. Rather you should just use basic operations like creating and assigning variables, equality (==), ifstatements, and the bitwise operations (~, &, <<, >>, |, ^)
.a.A function that returns whether a particular channel (integer 0-31) is enabled. boolisEnabled(intA, charchannel) { ... }
b.A function that returns a new integer, with the given channel enabled.intenableChannel(intA, charchannel) { ... }
In: Computer Science
JAVA
Write a Java console application that prompts the user to enter the radius of a circle, then prints its radius, diameter, circumference, and area.
The Console Output
Enter the radius of the circle: 1.2 The radius is 1.2 The diameter is 2.4 The circumference is 7.5398223686155035 The area is 4.523893421169302
Programmer Notes
In: Computer Science
5.30 Develop the function many() that takes as input the name of a file in the current directory (as a string) and outputs the number of words of length 1, 2, 3, and 4. Test your function on file sample.txt.
>>> many('sample.txt')
Words of length 1 : 2
Words of length 2 : 5
Words of length 3 : 1
Words of length 4 : 10
Coding language is python
In: Computer Science
HI, ANY PROGRAMMING LANGUAGE WOULD WORK, FROM PYTHON TO C++, MOST PREFERABLY OR ELSE ANY FOR YOUR CONVENIENCE.
Let f(x) = x6 + 7x5− 15x4− 70x3 + 75x2 + 175x − 125.
a.) Write a program that carries out the Secant Method on f(x). You do not need to make your program take arbitrary
input (i.e. you can tailor it to this specific f(x)). Your program should take as input the appropriate number of initial
guesses, an interval [a, b] and a desired error tolerance TOL. It should output a root r that is within the desired
tolerance and it should output N, the number of iterations it took to get to within the error tolerance. Make it clear
what procedure you are using to compute the error of your approximations.
b.) Write a program that carries out Steffensen′s Method on f(x). You do not need to make your program take arbitrary
input (i.e. you can tailor it to this specific f(x)). Your program should take as input the appropriate number of
initial guesses, an interval [a, b] and a desired error tolerance TOL. It should output a root r that is within the
desired tolerance and it should output N, the number of iterations it took to get to within the error tolerance. Make
it clear what procedure you are using as your underlying recursion, and how you are computing the error of your
approximations.
c.) Write a program that carries out Aitken′s Method on f(x). You do not need to make your program take arbitrary input
(i.e. you can tailor it to this specific f(x)). Your program should take as input the appropriate number of initial guesses,
an interval [a, b] and a desired error tolerance TOL. It should output a root r that is within the desired tolerance and
it should output N, the number of iterations it took to get to within the error tolerance. Make it clear what procedure
you are using as your underlying recursion, and how you are computing the error of your approximations.
d.) Write a program that carries out Newton′s Method on f(x). You do not need to make your program take arbitrary
input (i.e. you can tailor it to this specific f(x)). Your program should take as input the appropriate number of initial
guesses, an interval [a, b], and a desired error tolerance TOL. It should output a root r that is within the desired
tolerance and it should output N, the number of iterations it took to get to within the error tolerance. Make it clear
what procedure you are using to compute the error of your approximations
In: Computer Science
Write a program in MIPS Assembly.
This program will ask the user to enter 20 numbers. The program will store these numbers in an array in memory (sequential memory locations). It will then print out the list of numbers in three different formats:
Also, check for any wrong inputs and handle the error.
In: Computer Science
Translate the code in translateMe.c to MIPS in a file called translated.asm.Make sure you run both versions of the programto see that they get the same result.
Code:
int main() {
// use $t0 for x
int x = 0xC0FFEE00;
// use $t1 for y
unsigned int y = 0xC0FFEE00;
// use $t2 for z
int z = (x >> 8) & 0xFF;
// use $t3 for w
int w = ((y | 0xFF000000) << 6) ^ 0xFF;
}
In: Computer Science
What do these regular expressions mean in plain english?
a) ba*b + (ab)*
b) a*b* + b*ab
In: Computer Science
##You have received the phone bill.
##You have 4 phones on your family plan.
##You think that some members of the
##family are using too much data.
##
##You would like to calculate the following
##for each of the family members:
## lowest number of minutes used
## highest number of minutes used
## average number of minutes used
##
##The following list (named phonebill) consists
##of 4 lists, each detailing the name of the family
##member, the number of minutes that family member
##used during the week (7 days) and the phone
##number of that person
phonebill = [
["Kiera", [11,21,13,14,15,60,38], "508-111-1110"],
["Lorenzo", [20,12,33,26,37,62,70],"508-111-1111"],
["Mabel", [31,27,43,7,52,68,5],"508-111-1112"],
["Nikolai", [8,7,212,28,114,30,39],"508-111-1113"]
]
##you are to calculate the following for each family
##member and append it to the list of information
##for that family member:
## lowest number of minutes used
## highest number of minutes used
## average number of minutes used
##The list phonebill will be as follows after your program executes
[['Kiera', [11, 21, 13, 14, 15, 60, 38], '508-111-1110', 11, 60, 24.571428571428573],
['Lorenzo', [20, 12, 33, 26, 37, 62, 70], '508-111-1111', 12, 70, 37.142857142857146],
['Mabel', [31, 27, 43, 7, 52, 68, 5], '508-111-1112', 5, 68, 33.285714285714285],
['Nikolai', [8, 7, 212, 28, 114, 30, 39], '508-111-1113', 7, 212, 62.57142857142857]
]
Please done in Python format
In: Computer Science