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:
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 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 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
In: Computer Science
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:
In: Computer Science
All projects begin by answering one of two questions:
For this assignment, select a business scenario you would like to develop into a project over the next five weeks. You have two options:
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):
*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:
Senior management and investors have identified the following key technical factors for the success of the internet bank:
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 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 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 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
In: Computer Science
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 (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. 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:
*
*
*
*
*
*
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:
In: Computer Science
"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