Questions
A pizza restaurant requires 200 grams of flour, 10 ml of olive oil, 100 ml of...

  1. A pizza restaurant requires 200 grams of flour, 10 ml of olive oil, 100 ml of tomato sauce and 200 grams of cheese to make one of their basic pizzas. The restaurant’s supplier sells bags of flour weighing 5 kg each, drums of olive oil containing 5 litres, cans of tomato sauce containing 2 litres and bags of grated cheese weighing 1 kg. Write a python program to ask the user how many pizzas they expect to make in the following week and work out what supplies would need to bought from the supplier in order to meed the predicted demand. The program should also let the user know what quantities of each ingredient will be left over at the end of the week. include comments

In: Computer Science

Thanks in advance. In Java. I'm having an issue with one of my methods. Ex: The...

Thanks in advance.
In Java.
I'm having an issue with one of my methods.
Ex:

The array being pass in is a character array with element: w, ' ', K, Q, k, q, ' ', -, ' ', 0, ' ', 1

public class Find
{
public void enPassant(char[] array)
{
  for(int i = 0; i < array.length; ++i)
{
if(array[i] == 'e')
{
count = i;
}
else
{
count += 0;
}
}
  
if(count > 0)
{
System.out.println("En passant: " + array[count] + array[count + 1]);
}
  
if(count == 0)
{
System.out.println("En passant: none");
}
}

public class Main
{
public static void main(String[] args)
{
Find testDetail = new Find();
testDetail.enPassant(detailArray);

}

}

Output: Enpassant: kq

My intended output is: Enpassant: none

Why am i getting kq, and what can i do to correct my mistake?

In: Computer Science

In C++ Design and implement a program (name it ProcessGrades) that reads from the user four...

In C++ Design and implement a program (name it ProcessGrades) that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below.

In: Computer Science

JAVA CODE_ Use menu based functionality and validation loops to create a new customer bonus fruit...

JAVA CODE_

Use menu based functionality and validation loops to create a new customer bonus fruit package application for the Dirt to Dish discount produce company.

The program you create will prompt the user to enter a number to select one of three bonus pack options:

1 for Apple pack
2 for Orange pack
3 for Banana pack


**Use input validation to ensure a valid option has been selected before proceeding.

Use variables to keep track of how many of each fruit a customer will have depending on which bonus pack has been chosen. The amount of fruit per bonus pack is given as follows:

Banana pack: 5 bananas, 2 apples, 2 oranges
Orange pack: 5 oranges, 2 apples, 2 bananas
Apple pack: 5 apples, 2 bananas, 2 oranges

Use menu based functionality and input validation and prompt the user to choose from one of the following recipes:

1. Fruit medley (2 of each fruit)
2. Mixed Apple Pie (3 apples, 1 orange, 1 banana)
3. Banana tower (4 bananas, 2 oranges)
The amount of fruit required for each recipe is shown in parenthesis.

After a valid recipe choice has been made, subtract the amount of fruit needed for the recipe if the customer has enough fruit. If the customer does not have enough fruit then show a message telling the customer to buy more fruits.

Finally display the amount of fruit remaining from the bonus pack after the recipe selection has been made.

First example run:

This is Dirt to Dish's new customer bonus service!
Please select your free fruit package:
1. Apple pack
2. Orange pack
3. Banana pack
Please enter 1, 2, or 3: 2
You have chosen: Orange pack

You have a total of:
2 apples 5 oranges 2 bananas
Which dish would you like to make first?
1. Fruit medley (2 of each fruit)
2. Mixed Apple Pie (3apples, 1 orange, 1 banana
3. Banana tower (4 bananas, 2 oranges
Please enter 1, 2, or 3: 2
Mixed Apple Pie chosen
Sorry, you need more fruits!
The fruit you have left is:
2 apples
5 oranges
2 bananas

Thank you!

In: Computer Science

Create a 32-bit Linux-based assembler language program (nasm) which: 1. Defines these variables: A: A single...

Create a 32-bit Linux-based assembler language program (nasm) which:

1. Defines these variables:

A: A single byte

B: A word

C: A double word

D: A double word

2. Using the eax register (and its sub-registers), process the following equations (ONLY using the mov, add and sub assembly keywords):

I. A + (B + C) = D

II. (A + C) - B = D

3. Using the linux function library, print a string describing each equation, then values in each variable, and then the answer in the resulting variable

4.Use the following values in your equation:

I. 10h

II. 2000h

III. 30000

Sample Output: The Result of A + (B + C) = D is: 32010

When printing out a string in NASM, use the linux function library call PrintString. Make sure your string is 00h terminated. • When printing out a Hexadecimal value in NASM, use the linux function library call Print32bitNumHex

In: Computer Science

c++ do add comments for better understanding Lapindrome is defined as a string which when split...

c++

do add comments for better understanding

Lapindrome is defined as a string which when split in the middle, gives two halves having the same characters and same frequency of each character. If there are odd number of characters in the string, we ignore the middle character and check for lapindrome. For example gaga is a lapindrome, since the two halves ga and ga have the same characters with same frequency. Also, abccab, rotor and xyzxy are a few examples of lapindromes. Note that abbaab is NOT a lapindrome. The two halves contain the same characters but their frequencies do not match.
Your task is simple, declare a C++ Class Lapindrome that has a function checkLapindrome which display Yes if the string is Lapindrome otherwise, it should display No. The structure of the Class is given below. You are required to implement every function given in the class Lapindrome.

class Lapindrome
{
private:
int size; char* cstr;
public:
Lapindrome (int size=10); //initialize size and cstr
void setStr(char* cstr); //Assign the value of cstr to member variable cstr
char* getStr();
//returns the string cstr. void checkLapindrome (); //Display Yes if the cstr is Lapindrome otherwise No ~Lapindrome();
//Destructor

};

In: Computer Science

Would you consider a career in UX? Why or why not? How much experience/knowledge do you...

Would you consider a career in UX? Why or why not?

How much experience/knowledge do you have in user interface design, prototyping and usability?

In: Computer Science

Consider the following program that creates an ArrayList of objects of a type A, and sorst...

Consider the following program that creates an ArrayList of objects of a type A, and sorst them. Supply the missing code. Sample output when you run the program is shown below.

import java.util.*;

class A

{ int i, j, k;

public A(int i, int j, int k){

this.i=i;

this.j=j;

this.k=k;

}

public String toString(){

return "A("+i+","+j+","+k+")";

}

}

class SortA {

public static void main(String[] args){

ArrayList aL=new ArrayList();

Random rand= new Random(1000); //1000 is a seed value

for (int p=0; p<10; p++){

int i = rand.nextInt(100);

int j = rand.nextInt(200);

int k = rand.nextInt(300);

aL.add(new A(i, j, k));

}

System.out.println("----- Original arraylist------");

for (A a: aL){

System.out.println(a);

}

System.out.println("----- Sorting by first integer-------");

/*YOUR CODE - Use anonymous interface types to sort by first integer Field in A, and then print the resulting ArrayList */

System.out.println("----- Sorting by second integer-------");

/*YOUR CODE - Use anonymous interface types to sort by the second integer Field in A, and then print the resulting ArrayList */

System.out.println("----- Sorting by third integer-------"); /*YOUR CODE - Use anonymous interface types to sort by the third integer Field in A, and then print the resulting ArrayList */

} }

Output

----- Original list -------

A(87,135,276)

A(24,192,149)

A(41,45,164)

A(50,179,259)

A(72,183,36)

A(75,46,202)

A(23,41,222)

A(71,189,202)

A(93,142,49)

A(42,35,176)

----- Sorting by first integer-------

A(23,41,222)

A(24,192,149)

A(41,45,164)

A(42,35,176)

A(50,179,259)

A(71,189,202)

A(72,183,36)

A(75,46,202)

A(87,135,276)

A(93,142,49)

----- Sorting by second integer-------

A(42,35,176)

A(23,41,222)

A(41,45,164)

A(75,46,202)

A(87,135,276)

A(93,142,49)

A(50,179,259)

A(72,183,36)

A(71,189,202)

A(24,192,149)

----- Sorting by third integer-------

A(72,183,36)

A(93,142,49)

A(24,192,149)

A(41,45,164)

A(42,35,176)

A(75,46,202)

A(71,189,202)

A(23,41,222)

A(50,179,259)

A(87,135,276)

In: Computer Science

C program //In this assignment, we will find the smallest positive integer that // can be...

C program

//In this assignment, we will find the smallest positive integer that
// can be expressed as a sum of two positive cube numbers in two distinct ways.
// More specifically, we want to find the smallest n such that n == i1*i1*i1 + j1*j1*j1,
// n == i2*i2*i2 + j2*j2*j2, and (i1, j1) and (i2, j2) are not the same in the sense that
// not only (i1, j1) not euqal to (i2, j2), but also (i1, j1) not equal to (j2, i2).
// We practice using loops in this assignment.
// Also, we practice how to do an early exit in a loop. We exit the loop once we find the smallest n.
// Once we are done, we will be delighted surprised to find out that this number already played a big role in
// our computer science study.
#include <stdio.h>
int main()
{
   int i, j, n;

   //We assume the smallest such n is no more than 1000000
   for(n=1; n<=1000000; n++)
   {
       //Use count to record the number of different ways of summing two positive cube numbers to n
       int count = 0;
       //TO DO
       //Fill in code below

   }


   //Do not change code below
printf("%d is the solution:\n", n);
   for(i=1; i<=100; i++)
       for(j = i; j<= 100; j++)
           {
               if (i*i*i + j*j*j == n)
               {
                   printf("%d * %d * %d + %d * %d * %d = %d\n", i, i, i, j, j, j, n);
}
           }

   return 0;
   //Do not try to hard code the solution, that is not the way to learn.
}

In: Computer Science

2.Find an error in the following program var tvShow = "The Office"; if (tvShow =null) {...

2.Find an error in the following program

var tvShow = "The Office";

if (tvShow =null) {

   console.log("You did not enter a TV show.");

else {

   console.log(tvShow+ “  “);

}

3.Write a statement that assigns finalResult with the division of number1 by number2. Ex: If number1 is 6 and number2 is 2, finalResult is 3.

Var number1=6;

Var number2=2;

__________________________________________ (write an arithmetic calculation which gives the result 0)

Var finalResult=0;

4.What is the final value of numItems?

bonus = 0;

numItems = 1;

if (bonus > 10) {

   numItems = numItems + 3;

}

Solution:

5.Display elements at indices 2 and 3 in the array userNumbers separated by a space.

Var userNumbers=[1,6,41,8,24,4];

/* Your Solution Goes here */

6. Matching basic document tag order

7. The HTML below has an error. What deprecated tag is causing the error?

<!DOCTYPE html>

<html lang="en">

  <meta charset="UTF-8">

  <title>Learning HTML</title>

  <body>

    <center>This page uses deprecated HTML.</center>

  </body>

</html>

8.What is the difference between line breaks and Whitespace in html?

9.What is output to the console?

var names = [];

names[0] = "Sue";

names[1] = "Bob";

names[2] = "Jeff";

console.log(names[0] + names[1]);

10.Write the  missing table tags in the following program.

<table>

  (a)

    <th>Head 1 (b)

    <th>Head 2</th>

    (c) Head 3</th>

  </tr>

  <tr>

    (d) Item 1</td>

    <td>Item 2 (e)

    <td>Item 3</td>

  (f)

</table>

In: Computer Science

Nearby is a main() function demonstrating the use of the function earliest_word. Implement this function according...

Nearby is a main() function demonstrating the use of the function earliest_word. Implement this function according to the documentation given. My solution is about 25 lines plus some closing curly braces.

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

char *earliest_word(char *fname, int *nwords);

// Opens the file fname and reads words from it

// until the end of file is reached then closes

// the file. If the file to be opened doesn't

// exist, returns NULL and sets nwords to

// -1. Tracks the alphabetic "earliest" word that

// is read in as indicated by strcmp(). Tracks how

// many words in total are read and sets nwords to

// that value. Allocates a block of memory and

// copies the earliest word found into the block

// using strcpy(). Returns a pointer to the

// freshly allocated block.

//

// ASSUMPTIONS: Words are no longer than 127

// characters so will fit in an array of size

// 128. Files have at least one word in them.

int main(){

int count; char *file; char *early;

file = "vegetables.txt";

// pumpkin carrot beet squash cucumber

early = earliest_word(file, &count);

printf("%s: %d words, %s earliest\n",

   file,count,early);

// vegetables.txt: 5 words, beet earliest

free(early);

file = "fruits.txt";

// banana peach orange apple pineapple strawberry

early = earliest_word(file, &count);

printf("%s: %d words, %s earliest\n",

   file,count,early);

// fruits.txt: 6 words, apple earliest

free(early);

file = "not-there.txt";

early = earliest_word(file, &count);

if(early==NULL){

printf("%s not found\n",file);

// not-there.txt not found

}

return 0;

}

C programming

In: Computer Science

Which of the following represents the greatest risk? Group of answer choices The director of IT...

Which of the following represents the greatest risk? Group of answer choices

The director of IT (a key employee) resigned

An IT hardware failure occurred

The president of the company was fired for embezzlement

The company’s database is corrupted with no backup facilities

In: Computer Science

C++ 1. What is the minimum number of steps if there are 1, 2, 3, 4,...

C++

1. What is the minimum number of steps if there are 1, 2, 3, 4, or more disks? Try and solve the puzzle and fill in the table.

1 1
2 3
3 7
4 15
5 ?
6 ?
7 ?
8 ?

2. Write an explicit formula for the minimum number of steps required for the puzzle? Use H(n) = ? where n is the number of disks

3. What would be the best ADT to use for the posts in the puzzle? Why is that data structure best?

4. What would be the base case (n = 1) of this problem if a recursive solution was employed? Use three of the ADTs from the previous question for storage. The three posts are labeled A, B, C. Post A is the the starting post and Post C is the ending post. Write the answer in in pseudo code.

5. What are the rest of the cases given the base case?

if (n == 1)

            disk = A.top()

            A.pop()

            C.push(disk)


please refer to concept of "Tower of Hanoi"

In: Computer Science

We will create a program that will guess a number between 1 and 100 chosen by...

We will create a program that will guess a number between 1 and 100 chosen by the user.Your program will be iteratively built in several stages, where each stage focuses on implementing just one type of operation. Each stage will build upon the work from the previous stage. This is known as iterative design, a process that allows us to focus on working on a single, simple task at a time, but the resulting software slowly evolves into something much more complex.

Required Concepts: The final homework requires that you implement the following concepts: 1. Storage operations (store data in program) 2. Output operations (print data to screen) 3. Input operations (get data from user) 4. Selection operations (multiple selection based on player input) 5. Mathematical operations (arithmetic, equality, relational) 6. Repetition operations (loop game logic to model multiple turns) 7. Nested selection operations (validate that user’s selection meets rules requirements) CODE IN JAVA!!

In: Computer Science

Use R code to do the following!!!! 1. Create a vector v1 that will contain integers...

Use R code to do the following!!!!

1. Create a vector v1 that will contain integers from -30 to 60.
2. Copy v1 into a vector v2 and add names 'odd' or 'even' based on the value.
3. Copy v1 into a vector v3 and if the number can be divided by 3, replace it by 'NA'.
4. Assign the mean of v3 to v4 ignoring the 'NA'.

In: Computer Science