Questions
$$$$$$$$$$$$$$ please write in C# $$$$$$$$$$$$$$$ Write a program to keep track of a hardware store’s...

$$$$$$$$$$$$$$ please write in C# $$$$$$$$$$$$$$$

Write a program to keep track of a hardware store’s inventory. You will need to create necessary classes for handling the data and a separate client class with the main method.

The store sells various items. For each item in the store, the following information is maintained: item ID, item name, number of pieces currently in the store, manufacturer’s price of the item and the store’s selling price. Create a class Item to store the information about the items. Provide appropriate setters and getters. Override the toString() method.

Create a class Inventory that contains a vector of items. This class will contain a bunch of methods to help build the application. Create a static variable to keep track of the total different items in inventory. Every time a new item is added to the inventory this variable has to be updated.

  1. A method to create 5 Item objects by initializing the following properties of Item and returning a vector of Item.

ItemID,itemName,pInstore,manufPrice,sellingPrice

  1. A method to check whether an item is in the store by doing a lookup in the vector.
  2. A method to update the quantity on hand for the item being sold
  3. A method to report the quantity on hand for any item requested during purchase
  4. A method to print the report for the manager in the following format

ItemID     itemName               pInstore        manufPrice     sellingPrice

12            Circular saw            150               45.00      125.00

235        Cooking Range          50                450.0             850.00

.

Total Inventory: $####.##

Total number of items in the store:

The total inventory is the total selling value of all the items currently in the store. The total number of items is the sum of the number of pieces of all items in the store.

Create a separate client class with the main method, display the menu and use switch case statement to execute appropriate method. The main method should display a menu with the following choices such as:

  1. Check whether an item is in the store
  2. Sell an item
  3. Print the report

For option 1, the user must also be prompted for the itemID. You will then call the method created in the Inventory class.

For option 2, verify if pInstore > qtyOrdered. You will invoke the method created in Inventory class.

For option 3, display the report. Again, this is nothing but executing method from Inventory class.

Also after an item is sold update the appropriate counts. Initially, the number of pieces in the store is the same as the number of pieces ordered and the number of pieces of an item sold is zero. You will use the utility method created as part of Inventory class.

In: Computer Science

Create an application named SalesLeader. Add a class to your project called SalesPerson. (The default class...

Create an application named SalesLeader.

Add a class to your project called SalesPerson. (The default class may be called Program. Do not change this)

The SalesPerson class contains the following Properties:

FirstName - The salesperson's firs name (as a string)

SalesAmount - The sales amount ( as a double)

SalesArea - The 3 areas are the enumeration West Coast, MidWest, and East Coast.

Add a constructor which sets FirstName to "None", SalesAmount to 0 and SalesArea to MidWest.

Add a method which checks if the SalesAmount is greater than $100,000. If so, add 10% to the SalesAmount.

In the main class (Program), create the following:

Create 3 objects from SalesPerson.

                salesperson1

                salesperson2

                salesperson3

Prompt the user to set the amount of sales, first name and sales area for each object.

Display the name, sales amount and area for each sales person. Display which sales person is the Sales Leader this month and their commission (15% of total sales) … but first, add a method SalesLeaderTie to Program class to check if there might be a tie for Sales Leader. (Write Code in C#).

In: Computer Science

This is a homework question. It has to be done using JAVA language. And PAY ATTENTION...

This is a homework question. It has to be done using JAVA language. And PAY ATTENTION TO WHAT YOU CAN USE AND WHAT I SPECIFICALLY ADDED THAT CANT BE USED TO COMPLETE THIS.

Objective:

Write a program that takes in two words, and then it recursively determines if the letters of the first word are contained, in any order, in the second word. If the size of the first word is larger than the second then it should automatically return false. Also if both strings are empty then return true.

You May NOT: ******************************************************************************************

Use any iterative loops. In other words, no for-loops, no while-loops, no do-while-loops, no for-each loops.

Use the string method .contains(String)

You May: ******************************************************************************************

Use the string method .charAt(Index)

Hints:

Recursive methods generally attempt to solve a smaller problem then return the results of those in order to solve the larger one.

Think of how to do this with a loop, and use that to guide what parameters you’ll need for your recursive method.

Example Dialog:

Enter 2 words. I will determine if the letters of one is contained in the other

elf

self

They are contained!

Example Dialog 2:

Enter 2 words. I will determine if the letters of one is contained in the other

jerky

turkey

They are not contained

Example Dialog 3:

Enter 2 words. I will determine if the letters of one is contained in the other

asdf

fasted

They are contained!

In: Computer Science

MATLAB: Write a function called problem2 that takes an at most two-dimensional matrix A as its...

MATLAB:

Write a function called problem2 that takes an at most two-dimensional matrix A as its sole input. The function uses a while-loop to return the largest element of A. You are not allowed to use the built-in max function and you are also not allowed to use for-loops.

In: Computer Science

Questions for Security Engineering: Why is security difficult? How does it compare to other objectives like...

Questions for Security Engineering:

  • Why is security difficult?
  • How does it compare to other objectives like cost, power, performance, reliability?

In: Computer Science

Please construct a nondeterministic, deterministic, and minimum deterministic finite state machine for the following regular expressions....

Please construct a nondeterministic, deterministic, and minimum deterministic finite state machine for the following regular expressions. You have to show the construction process, not just the final result.

1) acb*a | bba*b+

2) d*adc | (a)b*bc*d

In: Computer Science

IN PYTHON: Write a program that asks the user for a path to a directory, then...

IN PYTHON:

Write a program that asks the user for a path to a directory, then updates the names of all the files in the directory that contain the word draft to instead say final

     EX: "term paper (draft).txt" would be renamed "term paper (final).txt"

BONUS (5pts): for any .txt file that your program changes the name of, have your program add a line of text that states "Edited on " followed by the current date to the end of the text in the file that it is editing.

In: Computer Science

c++ LINEAR SEARCH ARRAYS OF OBJECTS Use the Item class defined in question #12. 1. (3...

c++

LINEAR SEARCH ARRAYS OF OBJECTS

Use the Item class defined in question #12.

1. (3 pts) Declare an array of 1024 Item objects. Assuming the array is now sorted by Value (price per item * quantity).

2. Write a function (with both declaration/prototype (3 pts) and definition (6 pts) ) that takes an array of Item objects, an integer as array size and two references to integers that represents the start_index and end_index of Item object elements whose Values are 50.0.

The function's implementation should be:

  • initialize both start_index and end_index parameters to -1.
  • perform a linear search to identify the range of all elements whose Values are 50.0. Note: since the array is sorted your searching must stop as soon as some Item exceeds 50.0.
  • If there is only one item is found both start_index and end_index must be the same. Otherwise set start_index and end_index to indicate the range of elements

An example of such array of Items will be the below:

index                   0               1               2             3           4              5           6           7               8              9          ........

Value         21.4      23.3       50.0      50.0      50.0       67.5      88.0       88.3      95.2      141.5    ....... (Note that the array is sorted)

In this example your function must assign 2 to start_index and 4 to end_index.

#12

This question has two parts:

Part 1: Define an Item class with the following specifications:

NOTE: you must declare and define the class separately. Include the definitions of constructors/destructor and member functions in class declaration will result in 50% point deduction.

  • Constructors: (MUST USE member initializer syntax) (2 pts)
    • default constructor (set description to "Unknown", quantity to 0, value to 0.0)
    • non-default constructor (3 parameters with the same names as member data' names)
  • Destructor: output <description> <quantity> and <price per item>   (1 pts)
  • Member data (2 pts): description, quantity (how many), price per item. Do not initialize member data at declaration - it must be done in constructors)
  • static data (1 pts) : company name (initialized to "Foothill Merchandise")). Must be constant string and not accessible from outside of the class.
  • public static function (1 pts): to return company name
  • public member functions (3 pts):
    • accessors/mutators: to save your exam time only provide accessor/mutator for "price per item" member
    • Increment: take a positive integer as its only parameter and add it to quantity. If the parameter is negative simply return.
    • Value: return total value of the item (quantity * price per item)

NOTE: The class definition must follow Google naming convention for class name, member data names and member function names (do not use camelCase convention)

Part 2: (5 pts)

Instantiate two Item objects: one using the default constructor and the other using the non-default constructor (description: "Toys", quantity: 100, price per item: 29.95).

Invoke the company name (static data).

Set the price per item of the default object to the non-default object's price per item.

Output the Value of the non-default object.

Increment the default-object's quantity to 9999.

In: Computer Science

Hey, how do I create a function which receives one argument (string). The function would count...

Hey, how do I create a function which receives one argument (string). The function would count and return the number of alphanumeric characters found in that string. function('abc 5} =+;d 9') // returns 6 in JavaScript?

In: Computer Science

(python please) The Cache Directory (Hash Table):The class Cache()is the data structure you will use to...

(python please)

The Cache Directory (Hash Table):The class Cache()is the data structure you will use to store the three other caches (L1, L2, L3). It stores anarray of 3 CacheLists, which are the linked list implementations of the cache (which will be explained later). Each CacheList has been already initialized to a size of 200. Do not change this. There are 3 functions you must implement yourself:

•def hashFunc(self, contentHeader)oThis function determines which cache level your content should go in. Create a hash function that sums the ASCII values of each content header, takes the modulus of that sum with the size of the Cache hash table, and accordingly assigns an index for that content –corresponding to the L1, L2, or L3 cache. So, for example, let’sassume the header “Content-Type: 2”sumsto an ASCII value of 1334. 1334% 3 = 2. So, that content would go in the L3cache. You should notice a very obvious pattern in which contentheaders correspond to which caches. The hash function should be used by your insert and retrieveContent functions.

•def insert(self, content, evictionPolicy)oOnce a content object is created, call the cache directory’s insert function to insert it into the proper cache. This function should call the linked list’s implementation of the insert function to actually insert into the cache itself. The eviction policywill be a string –either ‘lru’or ‘mru’. These eviction policies will be explained later. oThis function should return a message including the attributes of the content object inserted into the cache. This is shown in the doctests.

•def retrieveContent(self, content)oThis function should take a content object, determine which level it is in, and then return the object if it is in the cache at that level. If not, it should return a message indicating that it was not found. This is known as a “cache miss”. Accordingly, finding content in a cache is known as a “cache hit”. The doctests show the format of the return statements.

In: Computer Science

Alice and Bob are experimenting with CSMA using a W2 Walsh table. Alice uses the code...

Alice and Bob are experimenting with CSMA using a W2 Walsh table. Alice uses the code [+1, +1] and Bob uses the code [+1, −1]. Assume that they simultaneously send a hexadecimal digit to each other. Alice sends (6)16 and Bob sends (B)16. Show how they can detect what the other person has sent.

In: Computer Science

I am tasked with creating a Java application that used 2 synchronized threads to calculate monthly...

I am tasked with creating a Java application that used 2 synchronized threads to calculate monthly interest and update the account balance

This is the parameters for reference to the code. Create a class AccountSavings. The class has two instance variables: a double variable to keep annual interest rate and a double variable to keep savings balance. The annual interest rate is 5.3 and savings balance is $100.
• Create a method to calculate monthly interest. • Create a method to run two threads. Use anonymous classes to create these threads. The first thread calls the monthly interest calculation method 12 times, and then displays the savings balance (the balance in 12th month). After that, this thread sleeps 5 seconds. The second thread calls the monthly interest calculation method 12 times, and then displays the savings balance (the balance in 12th month). Before the main thread ends, these two threads must be completed. • Add your main method into the same class and test your threads. After these two threads are executed, the savings balance must remain same

I am getting an error when calling monthlyInterest method inside my runThread method. non-static method monthlyInterest() cannot be referenced from a static context and I cant seem to figure out how to fix the issue.


import static java.lang.Thread.sleep;

class AccountSavings {

    double annualInterest=5.3;
    double savings=100.00;
  
  

    public void monthlyInterest(){
    double monthlyRate;
    monthlyRate = annualInterest/12;
    double balance = 0;
    balance+=savings*monthlyRate;
    }
  
    public synchronized static void runThread(){
  
        Thread t1;
        t1 = new Thread(){
            AccountSavings accountSavings= new AccountSavings();
            @Override
            public void run(){
                for(int i=1;i<13;i++){
                    System.out.println("Balance after " + i + "month: " + monthlyInterest());
                }
                try{sleep(5000);}
                catch(InterruptedException e){e.printStackTrace();}
            }
        };
    Thread t2= new Thread(){
  
    AccountSavings accountSavings=new AccountSavings();
    @Override
    public void run(){
  
        for(int i=1;i<13;i++){
        System.out.println("Balance after " + i + " month: " + monthlyInterest(balance));
        }
        try{sleep(5000);}
        catch(InterruptedException e){e.printStackTrace();}  
    }
    };
    t1.start();
    t2.start();
  
    }

    public static void main(String[] args){
  
        runThread();
  
    }

}

In: Computer Science

Using MATLAB to plot a communication system using PAM (binary) through AWGN discrete-time channel . PLZ...

Using MATLAB to plot a communication system using PAM (binary) through AWGN discrete-time channel . PLZ show your code and plot.

In: Computer Science

modify the program to cast vptr as a float and as a double build and run...

modify the program to cast vptr as a float and as a double

build and run your program

THIS IS THE PROGRAM CODE:

#include <stdio.h>

void main (void)

{

int intval = 255958283;

void *vptr = &intval;

printf ("The value at vptr as an int is %d\n", *((int *) vptr));

printf ("The value at vptr as a char is %d\n", *((char *) vptr));

}

In: Computer Science

Write a Java program implementing a Binary Tree which stores a set of integer numbers. (Not...

  1. Write a Java program implementing a Binary Tree which stores a set of integer numbers. (Not have duplicate nodes) (100 points)

    1. 1) Define the BinaryTree interface.

    2. 2) Define the Node class.

    3. 3) Define the class LinkedBinaryTree which implements BinaryTree Interface.

    4. 4) Define the class TestLinkedBinaryTree which tests all function of

      LinkedBinaryTree.

    5. 5) Operations

      • Add/Remove/Update integer members.

      • Display(three traversal algorithms), Search.

In: Computer Science