Questions
I am struggling with this assignment. I can't get the program to run when I enter...

I am struggling with this assignment. I can't get the program to run when I enter a number with the $ symbol followed by a number below 10. any help would be greatly appreciated.

Create a program named Auction that allows a user to enter an amount bid on an online auction item. Include three overloaded methods that accept an int, double, or string bid. Each method should display the bid and indicate whether it is over the minimum acceptable bid of $10. If the bid is a string, accept it only if one of the following is true: it is numeric and preceded with a dollar sign, or it is numeric and followed by the word dollars. Otherwise, display a message that indicates the format was incorrect.

class Auction
    {
        public static void Main(string[] args)
        {
            string bidamount;
            Console.Write("Enter bid: ");
            bidamount = Console.ReadLine();
            double num;
            int n;

            if (double.TryParse(bidamount, out num))
            {
                double bid = Convert.ToDouble(bidamount);

                if (valid(bid))
                {
                    Console.WriteLine("Bid is $" + bid + ".");
                    Console.WriteLine("Bid is at/over $10.");
                    Console.WriteLine("Bid accepted.");
                }
                else
                    Console.WriteLine("Invalid. Bid not acceptable.");
            }
            else if (int.TryParse(bidamount, out n))
            {
                int bid = Convert.ToInt32(bidamount);
                if (valid(bid))
                {
                    Console.WriteLine("Bid is $" + bid + ".");
                    Console.WriteLine("Bid is at/over $10.");
                    Console.WriteLine("Bid accepted.");
                }
                else
                    Console.WriteLine("Bid not acceptable.");
            }
            else
            {
                string bid = (bidamount);
                if (valid(bidamount))
                {
                    Console.WriteLine("Bid is $" + bid + ".");
                    Console.WriteLine("Bid is at/over $10.");
                    Console.WriteLine("Bid accepted.");
                }
                else
                    Console.WriteLine("Bid not acceptable.");
            }
            Console.ReadKey();
        }
        public static bool valid(int bid)
        {
            if (bid < 10)
                return false;
            else
                return true;
        }
        public static bool valid(double bid)
        {
            if (bid < 10)
                return false;
            else
                return true;
        }
        public static bool valid(string bid)
        {
            if (bid[0] == '$' && Convert.ToInt32(bid.Substring(1)) >= 10)
                return true;
            else if ((Convert.ToInt32(bid.Substring(0, 2)) >= 10) && (bid.Substring(2).Equals("dollars")))
            {
                return true;
            }
            else
                return false;
        }
    }

In: Computer Science

Write a program that performs the following two tasks: Reads an arithmetic expression in an infix...

Write a program that performs the following two tasks:

  1. Reads an arithmetic expression in an infix form, stores it in a queue (infix queue) and converts it to a postfix form (saved in a postfix queue).
  2. Evaluates the postfix expression.

Use the algorithms described in class/ lecture notes. Use linked lists to implement the Queue and Stack ADTs. Using Java built-in classes will result in 0 points. You must use your own Stack and Queue classes (my code is a good starting point). Submit the code + example runs to validate your code. Submit UML chart to show the program design.

TO ANSWERER: Please give a clear, complete, and detailed program in Java. Thank you!

In: Computer Science

USE R 2520 is the smallest number that can be divided by each of the numbers...

USE R

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. Now you need to create a function to find the smallest positive number that is evenly divisible by two numbers you input into the function. (For example, your input is 6 and 9, you need to find the smallest number which can be divided by 6, 7, 8 and 9)

In: Computer Science

I want to update this JAVA program to : Exit cleanly, and change the pie chart...

I want to update this JAVA program to : Exit cleanly, and change the pie chart to circle rather than an oval, and provide a separate driver please and thank you

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.util.Scanner;

import javax.swing.JComponent;
import javax.swing.JFrame;

// class to store the value and color mapping of the
// pie segment(slices)
class Segment {
double value;
Color color;

// constructor
public Segment(double value, Color color) {
this.value = value;
this.color = color;
}
}

class pieChartComponent extends JComponent {

private static final long serialVersionUID = 1L;
Segment[] Segments;

// Parameterized constructor
// create 4 segments of the pie chart
pieChartComponent(int v1, int v2, int v3, int v4) {
Segments = new Segment[] { new Segment(v1, Color.black), new Segment(v2, Color.green), new Segment(v3, Color.yellow),
new Segment(v4, Color.red) };
}

// function responsible for calling the worker method drawPie
public void paint(Graphics g) {
drawPie((Graphics2D) g, getBounds(), Segments);
}

// worker function for creating the percentage wise slices of the pie chart
  
void drawPie(Graphics2D g, Rectangle area, Segment[] Segments) {
double total = 0.0D;
// fin the total of the all the inputs provided by the user
for (int i = 0; i < Segments.length; i++) {
total += Segments[i].value;
}
  
// Initialization
double curValue = 0.0D;
int strtAngle = 0;
// iterate till all the segments are covered
for (int i = 0; i < Segments.length; i++) {
// compute start angle, with percentage
strtAngle = (int) (curValue * 360 / total);
// find the area angle of the segment
int arcAngle = (int) (Segments[i].value * 360 / total);

g.setColor(Segments[i].color);
g.fillArc(area.x, area.y, area.width, area.height, strtAngle, arcAngle);
curValue += Segments[i].value;
}
}
}

public class Graphic_Pie2D {
public static void main(String[] argv) {

System.out.println("Pleae provide 4 values, to create the pie chart");
Scanner input = new Scanner(System.in);
int v1, v2, v3, v4;
v1 = input.nextInt();
v2 = input.nextInt();
v3 = input.nextInt();
v4 = input.nextInt();
  
// create a JFrame with title
JFrame frame = new JFrame("Pie Chart");
frame.getContentPane().add(new pieChartComponent(v1,v2,v3,v4));
frame.setSize(500, 300);
frame.setVisible(true);

}
}

here's the assignment for reference :

Pie chart: prompt the user (at the command line) for 4 positive integers, then draw a pie chart in a window. Convert the numbers to percentages of the numbers’ total sum; color each segment differently; use Arc2D. No text fields (other than the window title) are required. Provide a driver in a separate source file to test your class.

In: Computer Science

Assembly langugage , please do comment each line or step if possible . Question 2 of...

Assembly langugage , please do comment each line or step if possible .

Question 2 of 2. Element wise vector multiplication: [30 marks] Write an assembly language program that performs element wise multiplication of two arrays of size 4 and stores the resultant array back into memory.
For Arrays A = [Aw, Ax, Ay, Az] and B = [Bw, Bx, By, Bz], the resultant array C = [Aw*Bw, Ax*Bx, Ay*By, Az*Bz]
1. Reserve and initialize memory for both input arrays
2. Reserve memory for the resultant array in READWRITE section of memory
3. Load the arrays and perform the element wise multiplication operation.
4. Store the resultant array back into memory
Example test case:
FIRST array = [2, 4, -6, 8], SECOND array = [1, 2, 3, 7].
Your program should compute the element wise multiplication of both arrays and store it back to the resultant array.
RESULT array would be computed as [2*1, 4*2, -6*3, 8*7] = [2, 8, -18, 56] (integer), where:
1. The first elements from both arrays (2 and 1) are multiplied and the result (2) is stored in the first location of the RESULT array.
2. The second elements (4 and 2) would be multiplied and the result (8) is stored in the second location of the RESULT array.
3. The third elements (-6 and 3) are multiplied and the result (-18) is stored in the third location
4. Finally, the fourth elements (8 and 7) are multiplied and the result (56) is stored in the fourth location
Resultant array = [0x00000002, 0x00000008, 0xFFFFFFEE, 0x00000038]
Make sure your code works for any input number, not just the test cases. Your code will be tested
on other test cases not listed here.
Please properly comment your code before submission.

In: Computer Science

I'm trying to write a feet to meters and centimeters program and I'm looking for a...

I'm trying to write a feet to meters and centimeters program and I'm looking for a little help so I can see how close I got. It should do the following:

  • Write a convertToMetric class that has the following field:
    • standard - holds a double, standard length value in feet.
  • The class should have the following methods:
    • Constructor - that accepts a length in feet (as a double) and stores it in the standard field.
    • setStandard - accepts a standard length in feet and stores it in standard.
    • getStandard - returns the value of the standard field, as a length in feet, no conversion required.
    • getMeters - returns the value of the standard field converted to meters.
    • getCentimeters - returns the value of the standard field converted to centimeters
  • A second class will be created and used to test the new object class. This, executable class, is to instantiate an object of 'convertToMetric' type. Then it will allow the user to use keyboard input to input a value for standard. That value will then be converted to meters and centimeters, and displayed.

In: Computer Science

All projects begin by answering one of two questions: How can I make business scenario ABC...

All projects begin by answering one of two questions:

  1. How can I make business scenario ABC better or more efficient?
  2. What business scenario can I automate to benefit organization XYZ?

For this assignment, select a business scenario you would like to develop into a project over the next five weeks. You have two options:

  1. You may select one of the two business scenarios described in the Select a Business Scenario document.
  2. You may select a business scenario of your own choosing.

This can be a scenario from your workplace; for example, a frustrating process you have been eager to rework or a potential process you have been thinking of that does not exist yet but that you think would be valuable to your organization if it were developed into an IT project.

Note: If you decide to select a business scenario of your own choosing, you must obtain approval from your instructor for your scenario before beginning the project proposal assignment, which is also due this week. This why I want this assignment due on Thursday, so you have time to work on the Project Proposal assignment after it is approved.

Download Select a Business Scenario.

Read through the options.

Type your selection (Scenario A, Scenario B, or Scenario C) directly into the Select a Business Scenario document (on the space provided next to each scenario). If you select Scenario C, you must include a scenario description as outlined in the document.

University of Phoenix Material

Select a Business Scenario

For this assignment, you will select the business scenario for which you wish to analyze and develop a technical architecture. The purpose of the technical architecture, which you will be developing during this 5-week capstone course, is to automate the business scenario and its processes.

In this course, you will develop a project based on (choose one):

  • Scenario A: Financial Services ____
  • Scenario B: Internet Bank ____
  • Scenario C: Student-defined* ____

*Note: If you choose Scenario C, you must include a description of your scenario in sufficient detail for your instructor to evaluate its appropriateness for this capstone project. Before you can begin the next assignment in this course, you must obtain approval for your business scenario from your instructor.

Use the information below to make your selection. As you do so, keep in mind that the technical architecture you will develop will need to include network and cloud infrastructures, database management systems, software applications, cloud services, and cyber security solutions. The software applications and technology you decide to incorporate into your architecture must be accessible by businesses and/or individuals; that is, it must exist on the market today.

Here are the three business scenarios in detail:

Scenario A: Financial Services You work in the IT department of a financial services company that sells investments to, and manages investment portfolios for, high net worth individuals. Your organization uses custom-built legacy software applications and systems to support its sales processes. The sales software applications and systems are not integrated, and they do not support an enterprise view of the sales processes throughout the organization. Management is frustrated because the sales applications and systems do not provide the information and reports necessary for them to measure, monitor, and manage sales production in the organization. Sales executives and account managers are frustrated because the sales software applications and systems do not support the sales cycle for the products and services that the organization sells.

You have been assigned to analyze your organization’s sales processes and identify an IT system capable of improving the sales processes of your organization. In addition, your organization is looking for an easy-to-use, cloud-based Customer Relationship Management (CRM) solution to generate more leads, increase sales, improve customer service, reduce the cost of sales for the organization, and increase revenue.

Scenario B: Internet Bank You work for a startup company that is launching an internet bank. The internet bank will provide the following financial products and services to its customers:

  • Accounts and deposits
  • Credit, debit, and travel cards
  • Loans
  • Insurance
  • Investments
  • Tax services

Senior management and investors have identified the following key technical factors for the success of the internet bank:

  • Scalability - The technology and software application infrastructure must accommodate high growth and new users without impacting the service levels delivered to existing users.
  • Availability - Users must be supported with robust, consistent, and reliable access; excellent performance 24 hours a day, 7 days a week.
  • Security – Industry-accepted security practices and a multi-level authentication systems have to be put in place to authenticate and identify each user before they access their accounts and initiate transactions.
  • Manageability – The technology and software applications infrastructure must be easy to manage, support, and update.

You have been assigned to analyze your organization and develop a technical architecture to support the business processes of this internet bank.

Scenario C: Student-Defined: Describe a business scenario (including short descriptions of the related business processes that make up that scenario, which can be similar to the descriptions in Scenario A and Scenario B) that you are interested in developing into a project. Remember to submit your description to your instructor for approval as soon as possible.

In: Computer Science

On a raspberry pi, write an assembler program that will calculate the factorial of an integer...

On a raspberry pi, write an assembler program that will calculate the factorial of an integer value inputted by the user. the program should detect if an overflow occurs. If no overflow occurred, then it should print out the value of the factorial. Otherwise print out a message indicating that an overflow occurred.

In: Computer Science

Modify the insertionSort() method in insertSort.java so it counts the number of copies and the number...

Modify the insertionSort() method in insertSort.java so it counts the number of copies and the number of comparisons it makes during a sort and displays the totals. To count comparisons, you will need to break up the double condition in the inner while loop. Use this program to measure the number of copies and comparisons for different amounts of inversely sorted data. Do the results verify O(N2 ) efficiency? Do the same for almost-sorted data (only a few items out of place). What can you deduce about the efficiency of this algorithm for almost-sorted data?

// insertSort.java

class ArrayIns
{
private long[] a; // ref to array a
private int nElems; // number of data items

public ArrayIns(int max) // constructor
{
a = new long[max]; // create the array
nElems = 0; // no items yet
}

public void insert(long value) // put element into array
{
a[nElems] = value; // insert it
nElems++; // increment size
}

public void display() // displays array contents
{
for(int j=0; j<nElems; j++) // for each element,
System.out.print(a[j] + " "); // display it
System.out.println("");
}

public void insertionSort()
{
int in, out;

for(out=1; out<nElems; out++) // out is dividing line
{
long temp = a[out]; // remove marked item
in = out; // start shifts at out
while(in>0 && a[in-1] >= temp) // until one is smaller,
{
a[in] = a[in-1]; // shift item to right
--in; // go left one position
}
a[in] = temp; // insert marked item
} // end for
} // end insertionSort()

} // end class ArrayIns

class InsertSortApp
{
public static void main(String[] args)
{
int maxSize = 100; // array size
ArrayIns arr; // reference to array
arr = new ArrayIns(maxSize); // create the array

arr.insert(77); // insert 10 items
arr.insert(99);
arr.insert(44);
arr.insert(55);
arr.insert(22);
arr.insert(88);
arr.insert(11);
arr.insert(00);
arr.insert(66);
arr.insert(33);

arr.display(); // display items

arr.insertionSort(); // insertion-sort them

arr.display(); // display them again
} // end main()
} // end class InsertSortApp

In: Computer Science

Create a C program that performs the following (please comment the codes): a) Create a Stack...

Create a C program that performs the following (please comment the codes):

a) Create a Stack ADT. Stack should be implemented using the linked list.

b) Enter 10 random integer numbers between 0 to 50 in the stack.

c) After pushing each element, print the content of the top of the stack.

c) Then pop out those 10 integer numbers and print those numbers.

d) Finally destroy the Stack.

In: Computer Science

Write a recursive function to implement the Factorial of n (n!). In the main, let the...

Write a recursive function to implement the Factorial of n (n!). In the main, let the user input a positive integer and call your function to return the result.

In: Computer Science

Python 3! Please provide detailed information and screenshots! This is a practice for you to discuss...

Python 3! Please provide detailed information and screenshots!

This is a practice for you to discuss an implementation of a BST (Binary Search Tree) in a real-life scenario or real business scenario.

What to submit?

1. An introduction with a title of what is the implementation

2. A diagram or design of how the BST is implemented in your scenario

3. Simple explanation of the implementation

4. Can you make it as an application in Python. Yes/No. If Either Yes or No. What it takes to implement or What are the complexities involved.

5. Design of the application - Write down (not the code) design of Data Collection, Storage of data, OOP design of Application, Pseudo Code of the Design or flow chart, UML diagram.

In: Computer Science

Using JAVA Create a class Client. Your Client class should include the following attributes: Company Name...

Using JAVA

Create a class Client. Your Client class should include the following attributes:

Company Name (string)

Company id (string)

Billing address (string)

Billing city (string)

Billing state (string)

Write a constructor to initialize the above Employee attributes.

Create another class HourlyClient that inherits from the Client class.   HourClient must use the inherited parent class variables and add in hourlyRate and hoursBilled. Your Hourly Client class should contain a constructor that calls the constructor from the Client class to initialize the common instance variables but also initializes the hourlyRate and hoursBilled. Add a billing method to HourlyClient to calculate the amount due from a service provided. Note that billing amount is hourly rate * hoursBilled

Create a test class that prompts the user for the information for five hourly clients, creates an ArrayList of 5 hourly client objects, display the attributes and billing for each of the five hourly clients. Display the company name and billing amount for each company and the total billing amount for all five companies.

In: Computer Science

C Program: Create a C program that prints a menu and takes user choices as input....

C Program: Create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen.

The specifications must be followed exactly, or else the input given in the script file may not match with the expected output.

Important! Consider which control structures will work best for which aspect of the assignment. For example, which would be the best to use for a menu?

The first thing your program will do is print a menu of choices for the user. You may choose your own version of the wording or order of choices presented, but each choice given in the menu must match the following:

Menu Choice Valid User Input Choices
Enter/Change Character 'C' or 'c'
Enter/Change Number 'N' or 'n'
Draw Line 'L' or 'l'
Draw Square 'S' or 's'
Draw Rectangle 'R' or 'r'
Draw Triangle (Left Justified) 'T' or 't'
Quit Program 'Q' or 'q'


A prompt is presented to the user to enter a choice from the menu. If the user enters a choice that is not a valid input, a message stating the choice is invalid is displayed and the menu is displayed again.

Your program must have at least five functions (not including main()) including:

  • A function that prints the menu of choices for the user, prompts the user to enter a choice, and retrieves that choice. The return value of this function must be void. The function will have one pass-by-reference parameter of type char. On the function's return, the parameter will contain the user's menu choice.
  • A function that prompts the user to enter a single character. The return value of the function be a char and will return the character value entered by the user. This return value will be stored in a local variable, C, in main(). The initial default value of this character will be ' ' (blank or space character).
  • A function that prompts the user to enter a numerical value between 1 and 15 (inclusive). If the user enters a value outside this range, the user is prompted to re-enter a value until a proper value is entered. The return value of the function be an int and will return the value entered by the user. This return value will be stored in a local variable, N, in main(). The initial default value of this character will be 0.
  • A function for each geometric shape. Each function will take the previously entered integer value N and character value C as input parameters (You will need to ensure that these values are valid before entering these functions). The return values of these functions will be void. The functions will print the respective geometric shape of N lines containing the input character C. N is considered the height of the shape. For a line, it is just printing the character in C, N number of times, so that it creates a vertically standing line of length N. For N = 6 and C = '*', the draw line function should output:

    *
    *
    *
    *
    *
    *


    If a square is to be printed, then the following output is expected:
    ******
    ******
    ******
    ******
    ******
    ******

In case of a rectangle, we assume its width is N+5. It should look like the following:
    ***********
    ***********
    ***********
    ***********
    ***********
    ***********


    If the user selects Triangle, then it should print a left justified triangle which looks like the following:

    *
    **
    ***
    ****
    *****
    ******

Suggested steps:

  1. Create a source file with only your main() function and the standard #include files. Compile and run (it won't do anything, but if you get compile errors, it is best to fix them immediately).
  2. Write a function, called from main(), that prints the menu. Compile and test it to ensure it works properly.
  3. Add a pass-by-reference parameter to your menu() function that will retrieve the character input within the function and make it available for use within the main function. The menu function must remain a void function and not return a value.
  4. Add code to the menu() function to prompt and retrieve user input (allow any character), and assign that input character to the pass-by-reference parameter). Compile and test your code.
  5. Enclose the print menu function and user input code within a loop that will exit the program when the Quit program choice is entered. Test the logic of your code to ensure that the loop only exits on proper input ('q' or 'Q').
  6. Create five "stub functions" for the six other (non-Quit) choices. Put a print statement such as "This is function EnterChar()" or some other informative statement in the body of the function. For functions that return a value, return a specific character 'X' or number. This will be changed when the function is filled in.
  7. Within the loop in main(), create the logic to call each function based on input from the menu choice (and handle incorrect input choices). Test this logic by observing the output of the stub function statements.
  8. Fill in the logic and code for each function. Note that the Line drawing function is probably a little easier (logically) to write than the Right Justified Printing function, so you may want to write it first. Once you have the Line drawing function complete, think about what additional character(s) you will have to print (and how many) to make a square shape. Step by step, you can write functions for other shapes as well. This is the part of the lab (and the course) where you develop your skills to create algorithms that solve specific problems. These kinds of skills are not specific to C or any other language, but how to implement these algorithms are language specific.
  9. Test your program thoroughly.

In: Computer Science

"IT Security Policy Enforcement and Monitoring" Please respond to the following: Describe how monitoring worker activities...

"IT Security Policy Enforcement and Monitoring" Please respond to the following:

Describe how monitoring worker activities can increase the security within organizations.  Describe the rationale that managers should use to determine the degree of monitoring that the organization should conduct.
Explain the extent to which you believe an organization has the right to monitor user actions and traffic. Determine the actions organizations can take to mitigate the potential issues associated with monitoring user actions and traffic.

In: Computer Science