Questions
Must make a "Calculator" using C. The calculator must subtract, add, divide, and multiply inputs, and...

Must make a "Calculator" using C. The calculator must subtract, add, divide, and multiply inputs, and tell whether a number is prime or not. The user chooses how many inputs go into the calculator.

For example, the code will ask the user what function they want. If the user chooses to subtract, the the code will then ask the user how many numbers they want to subtract. After, the code will ask the user to input as many numbers as they chose in the last step. Lastly, the code must subtract the first input - the second input - the third input and so on, and must print the answer.

In: Computer Science

​​​​​​​in c code Add an intro screen Ask the user for their name, what type of...

​​​​​​​in c code

  • Add an intro screen
  • Ask the user for their name, what type of cookie they would like to order and how many.
  • The types are sugar, chocolate chip, and peanut butter.
  • Assign a cost to each cookie.
  • Show total for cookie purchase and ask if the would like to place another order.
  • Include at least one function and one loop.
  • Add one extra feature.

For example, a sample execution of your code would be as follows:

Cookie Corner! (name it whatever you want)

Please enter your first name.

Jane

Jane, what type of cookie would you like to order?

  1. Sugar - $0. 25
  2. Chocolate Chip - $0.35
  3. Peanut Butter - $0.35

1

You selected a SUGAR cookie. How many cookies would you like?

4

Jane, your total cost is $1.00

Would you like to order another type of cookie?

No

Thanks for ordering!

In: Computer Science

In Chapter 4 of your book, you created an interactive application named MarshallsRevenue that prompts a...

In Chapter 4 of your book, you created an interactive application named MarshallsRevenue that prompts a user for the number of interior and exterior murals scheduled to be painted during a month and computes the expected revenue for each type of mural. The program also prompts the user for the month number and modifies the pricing based on requirements listed in Chapter 4.

Now, modify the program so that the user must enter a month value from 1 through 12. If the user enters an incorrect number, the program prompts for a valid value. Also, the user must enter a number between 0 and 30 inclusive for the number of murals of each type; otherwise, the program prompts the user again.

Below is the source code

using System;

class MainClass

{

public static void Main (string[] args) //main function

{

//variable declaration

int month,intmu,extmu,total;

total=0;

string[] arr = new string[] {"January", "February", "March", "April", "May",

"June", "July", "August", "September", "October", "November", "December"};

do

{

//accepting the month value from user

Console.WriteLine ("Enter a month number");

month = Convert.ToInt32(Console.ReadLine());

if(month<1 || month >12)

Console.WriteLine ("Enter a valid value between 1 to 12");

}while(month<1 || month >12);

do

{

//accepting interior mural number from user

Console.WriteLine ("Enter number of interior murals");

intmu = Convert.ToInt32(Console.ReadLine());

if(intmu < 0 || intmu >30)

Console.WriteLine ("Enter a valid value between 0 to 30");

}while(intmu < 0 || intmu >30);

do

{

//accepting exterior mural number from user

Console.WriteLine ("Enter number of exterior murals");

extmu = Convert.ToInt32(Console.ReadLine());

if(extmu < 0 || extmu >30)

Console.WriteLine ("Enter a valid value between 0 to 30");

}while(extmu < 0 || extmu >30);

//displaying the data

Console.WriteLine ("Revenue for the month of "+arr[month-1]);

Console.WriteLine("Number of interior murals : "+intmu);

Console.WriteLine("Number of exterior murals : "+extmu);

//calcultaing the total revenue

total=(100*intmu)+(200*extmu);

Console.WriteLine("Total Revenue : Rs "+total);

}

}

Please provide source code and display response.

In: Computer Science

Prove the following using the properties of regular expressions: (ab)* + c + c* = Λ...

Prove the following using the properties of regular expressions:

  1. (ab)* + c + c* = Λ + ab + (ab)* + c(Λ + c*)  
  2. Λ+ab+abab+ababab(ab)* = Λ + ∅* + (ab)*
  3. a(b+c*) + (d+e)* = ab + ac*c* + d + e + (d+e)*
  4. a*b + a*a*bc* + d* + ab = d* + ab + a*bc* + Λ
  5. a(b+cd*) = a(b+c) + acdd*
  6. (a+b)* = ∧* + ∅* + (a*b*)*
  7. (ab)*(c*+d*) = (ab)*(c+c*) + (ab)*( ∧ + d*)

In: Computer Science

An OBST (optimal BST) minimizes the average search time across all keys in the BST. Given...

  1. An OBST (optimal BST) minimizes the average search time across all keys in the BST. Given 5 ordered keys. k1<k2<k3<k4<k5, with probabilities of occurrence (0.25, 0.15, 0.10, 0.20, 0.30), respectively
    1. Use a Greedy algorithm that attempts to construct a BST that is an OBST.
    2. What is the complexity of your Greedy algorithm?  
    3. Is your Greedy BST an OBST? Explain
    4. apply the DP algorithm to acquire an OBST
    5. show your work, including tables and the extraction of the actual OBST
    6. analyze the complexity of the DP algorithm

In: Computer Science

Let X = {x1,x2,...,xn} a sequence of real numbers. Design an algorithm that in linear time...

Let X = {x1,x2,...,xn} a sequence of real numbers. Design an algorithm that in linear time finds the continue subsequence of elements xi,xi+1,...,x, which product is the maximum. Suppose that the product of an empty subsequence is 1 and observe that the values can be less to 0 and less to 1.

In: Computer Science

Comment the code explaining what each line is doing. The first line has been done for...

Comment the code explaining what each line is doing. The first line has been done for you.

x=[0 0 -1 2 3 -2 0 1 0 0]; %input discrete-time signal

x dtx= -2:7;

y=[1 -1 2 4];

dty=8:11;

z=conv(x,y);

dtz=6:18;

subplot(1,3,1), stem(dtx,x)

subplot(1,3,2), stem(dty,y)

subplot(1,3,3), stem(dtz,z)

In: Computer Science

Use the cumsum command in MATLAB to show that the cumulative sum of an impulse is...

Use the cumsum command in MATLAB to show that the cumulative sum of an impulse is a unit step function. Add a line to your code from Problem 2. Plot the unit step function generated by the cumsum command. Turn in a copy of the code and graph.

In: Computer Science

What strategies can be used to test contingency plans? [MANAGEMENT OF INFORMATION SECURITY]

  1. What strategies can be used to test contingency plans? [MANAGEMENT OF INFORMATION SECURITY]

In: Computer Science

In one paragraph, please briefly explain why cloud customer should use AWS KMS.

In one paragraph, please briefly explain why cloud customer should use AWS KMS.

In: Computer Science

Use one sentence to briefly describe the difference between symmetric encryption and asymmetric encryption.

Use one sentence to briefly describe the difference between symmetric encryption and asymmetric encryption.

In: Computer Science

Resource Monitor. Windows 10 Uncheck perfmon.exe. Currently the CPU section is sorted alphabetically by image name....

Resource Monitor. Windows 10

Uncheck perfmon.exe.

  1. Currently the CPU section is sorted alphabetically by image name. Click on the CPU column to sort it by CPU utilization. What process is using the most CPU?

In: Computer Science

C++ // Program Description: This program accepts three 3-letter words and prints out the reverse of...

C++

// Program Description: This program accepts three 3-letter words and prints out the reverse of each word

  1. A main(. . . ) function and the use of std::cin and std::cout to read in data and write out data

    as described below.

  2. Variables to hold the data read in using std::cin and a return statement.

#include <iostream >

int main(int argc, char *argv[]) {

.... your code goes here

}//main

Example usage:

>A01.exe
Enter three 3-letter space separated words, then press enter to display the reverse:
cat eye fix
tac eye xif
Enter any key to exit:

In: Computer Science

Python Problem 4. Estimate pi version 2: write a program that will quickly estimate pi to...

Python

Problem 4. Estimate pi version 2: write a program that will quickly estimate pi to a precision of 1e-4 using a monte carlo approach. Your program should employ a loop where each iteration produces a new x,y pair. One will then determine whether the x,y pair lies inside or outside the circle. (see below) Since all the points will land within the square shown above but only a fraction will land within the circle, we can estimate pi by relating the area of the quarter circle shown above to the area of the square. As we randomly choose points, we can determine if they fall within the circle or not and form a ratio as shown below: AreaQtrcircle / AreaSqaure = πr 2 / 4r 2 = π / 4 = Points in Circle / All Points, π ≅ 4* Points in Circle / All Points.

Your loop should continue until the absolute value of the difference between the current estimate and the previous estimate is less than 1e-4. The program should output the estimate of pi and the number of iterations (points) needed to reach the desired level of precision. Run your program several times to see if the number of points changes. Note any observations in the comments.

In: Computer Science

(In Java) Implement a Deque in which addFirst(), addLast(), removeFirst(), removeLast(), and getMin() are all in...

(In Java) Implement a Deque in which addFirst(), addLast(), removeFirst(), removeLast(), and getMin() are all in O(1) (amortized). The getMin() method is supposed to find the minimum value in the deque and update after ever add/remove. I tried implementing this with a Deque and LinkedList but wasn't successful, you do not need to use either. Must use the comparator and iterator. The goal is to be as fast as possible, so this includes avoiding any operations that aren't O(1) as much as possible. I used my own testing class. Thanks!

import java.util.*;

public class FMinDeque<T> implements MinDeque<T> {

    protected Comparator<? super T> comp;
    Deque<T> dq;
    protected List<T> min;
    T m;
    public FMinDeque() {
        this(new DefaultComparator<T>());
    }
    public FMinDeque(Comparator<? super T> comp) {
        this.comp = comp;
        dq = new ArrayDeque<T>();
        min = new LinkedList<T>();
    }
    public Comparator<? super T> comparator() {
        return comp;
    }
    public void addFirst(T x) {

    }
    public void addLast(T x) {

    }
    public T removeFirst() {
        
        return null;
    }
    public T removeLast() {
        
        return null;
    }
    public T getMin() {
      
    }
    public int size() {
        return dq.size();
    }
    public Iterator<T> iterator() {
        return dq.iterator();
    }
}

This extends:

import java.util.Comparator;

    public interface MinDeque<T> extends Iterable<T>
    {
        public Comparator<? super T> comparator();

        public void addFirst(T x);
        public void addLast(T x);

        public T removeFirst();
        public T removeLast();

        public T getMin();

        public int size();

And

import java.util.Comparator;

class DefaultComparator<T> implements Comparator<T> {
    @SuppressWarnings("unchecked")
    public int compare(T a, T b) {
        return ((Comparable<T>)a).compareTo(b);
    }
}

In: Computer Science