Questions
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

Chapter 6: Use a list to store the players Update the program in python so that...

Chapter 6: Use a list to store the players

Update the program in python so that it allows you to store the players for the starting lineup. This

should include the player’s name, position, at bats, and hits. In addition, the program

should calculate the player’s batting average from at bats and hits.

Console

================================================================

Baseball Team Manager

MENU OPTIONS

1 – Display lineup

2 – Add player

3 – Remove player

4 – Move player

5 – Edit player position

6 – Edit player stats

7 - Exit program

POSITIONS

C, 1B, 2B, 3B, SS, LF, CF, RF, P

================================================================

Menu option: 2

Name: Mike

Position: C

At bats: 0

Hits: 0

Mike was added.

Menu option: 1

Player POS AB H AVG

----------------------------------------------------------------

1 Joe P 10 2 0.2

2 Tom SS 11 4 0.364

3 Ben 3B 0 0 0.0

4 Mike C 0 0 0.0

Menu option: 6

Lineup number: 4

You selected Mike AB=0 H=0

At bats: 4

Hits: 1

Mike was updated.

Menu option: 4

Current lineup number: 4

Mike was selected.

New lineup number: 1

Mike was moved.

Menu option: 7

Bye!

Specifications

 Use a list of lists to store each player in the lineup.

 Use a tuple to store all valid positions (C, 1B, 2B, etc).

 Make sure that the user’s position entries are valid.

In: Computer Science

Chapter 6: Use a list to store the players In Python, Update the program so that...

Chapter 6: Use a list to store the players

In Python, Update the program so that it allows you to store the players for the starting lineup. This

should include the player’s name, position, at bats, and hits. In addition, the program

should calculate the player’s batting average from at bats and hits.

Console

================================================================

Baseball Team Manager

MENU OPTIONS

1 – Display lineup

2 – Add player

3 – Remove player

4 – Move player

5 – Edit player position

6 – Edit player stats

7 - Exit program

POSITIONS

C, 1B, 2B, 3B, SS, LF, CF, RF, P

================================================================

Menu option: 2

Name: Mike

Position: C

At bats: 0

Hits: 0

Mike was added.

Menu option: 1

Player POS AB H AVG

----------------------------------------------------------------

1 Joe P 10 2 0.2

2 Tom SS 11 4 0.364

3 Ben 3B 0 0 0.0

4 Mike C 0 0 0.0

Menu option: 6

Lineup number: 4

You selected Mike AB=0 H=0

At bats: 4

Hits: 1

Mike was updated.

Menu option: 4

Current lineup number: 4

Mike was selected.

New lineup number: 1

Mike was moved.

Menu option: 7

Bye!

Specifications

 Use a list of lists to store each player in the lineup.

 Use a tuple to store all valid positions (C, 1B, 2B, etc).

 Make sure that the user’s position entries are valid.

In: Computer Science

Stock Price # Shares X Y Z X Y Z Jan. 13, 1999 25 40 30...

Stock Price # Shares
X Y Z X Y Z
Jan. 13, 1999 25 40 30 1000 2000 1000**
Jan. 14, 1999 25 42 7 1000 2000 5000
Jan. 15, 1999 27 42 8 1000** 2000 5000
Jan. 16, 1999 14 44 10 2000 2000 5000
*5:1 Split on Stock Z after Close on Jan. 13, 1999 **2:1 Split on Stock X after Close on Jan. 15, 1999
WHAT IS THE PRICE WEIGHTED INDEX ON JANUARY 13TH
What is the divisor at the beginning of January 14th
WHAT IS THE PRICE WEIGHTED INDEX ON JANUARY 15TH
What is the divisor at the beginning of January 16th
WHAT IS THE RETURN FROM JAN 13 TO JAN 16

In: Finance

You need a particular piece of equipment for your production process. An​ equipment-leasing company has offered...

You need a particular piece of equipment for your production process. An​ equipment-leasing company has offered to lease the equipment to you for $ 10,100 per year if you sign a guaranteed 5​-year lease​ (the lease is paid at the end of each​year). The company would also maintain the equipment for you as part of the lease.​ Alternatively, you could buy and maintain the equipment yourself. The cash flows from doing so are listed below​(the equipment has an economic life of 5 ​years). If your discount rate is 6.6%​, what should you​ do?

Year 0 = -$40,700

Year 1: -$2000

Year 2: -$2000

Year 3: -$2000

Year 4: -$2000

Year 5: -$2000

a.) The net present value of the leasing alternative is:

b.) The net present value of the buying alternative is:

In: Finance

1. Consider the following data for the “home” country of Afar (whose currency is the Afarian...

1. Consider the following data for the “home” country of Afar (whose currency is the Afarian pound, £); the “foreign” currency is the U.S. dollar ($):

2000    2006

E £20/$                 £22/$

Phome 100                    140

Pforeign         100                     110

  1. Calculate the real exchange rate for 2000 and 2006.
  2. Did the Afarian pound appreciate or depreciate in nominal terms? in real terms? Explain your answer intuitively.
  3. What do you think has happened to Afar’s trade balance (E- Z) between 2000 and 2006?
  4. Does (relative) purchasing power parity hold for Afar between 2000 and 2006? Why or why not?
  5. What would the nominal exchange rate e have to be in 2006, in order for purchasing power parity to hold (i.e., to keep the real exchange rate constant at its 2000 level)?

In: Economics

Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and...

Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.29 million and create incremental cash flows of $632,693.00 each year for the next five years. The cost of capital is 11.03%. What is the net present value of the J-Mix 2000?

Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.56 million and create incremental cash flows of $443,493.00 each year for the next five years. The cost of capital is 10.74%. What is the internal rate of return for the J-Mix 2000?

Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.67 million and create incremental cash flows of $639,849.00 each year for the next five years. The cost of capital is 8.28%. What is the profitability index for the J-Mix 2000?

Please answer all 3:)

In: Accounting

#31 Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make...

#31 Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.38 million and create incremental cash flows of $877,269.00 each year for the next five years. The cost of capital is 11.18%. What is the net present value of the J-Mix 2000?

#32 Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.95 million and create incremental cash flows of $547,959.00 each year for the next five years. The cost of capital is 11.75%. What is the internal rate of return for the J-Mix 2000?

#33 Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.93 million and create incremental cash flows of $590,625.00 each year for the next five years. The cost of capital is 10.39%. What is the profitability index for the J-Mix 2000?

In: Finance

1.Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and...

1.Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.72 million and create incremental cash flows of $563,361.00 each year for the next five years. The cost of capital is 9.95%. What is the net present value of the J-Mix 2000?

2.Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.72 million and create incremental cash flows of $566,982.00 each year for the next five years. The cost of capital is 8.44%. What is the internal rate of return for the J-Mix 2000?

3.Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.73 million and create incremental cash flows of $500,066.00 each year for the next five years. The cost of capital is 10.74%. What is the profitability index for the J-Mix 2000?

In: Finance

Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and...

Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.33 million and create incremental cash flows of $861,681.00 each year for the next five years. The cost of capital is 8.75%. What is the net present value of the J-Mix 2000?

Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.86 million and create incremental cash flows of $571,580.00 each year for the next five years. The cost of capital is 9.90%. What is the internal rate of return for the J-Mix 2000?

Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.79 million and create incremental cash flows of $641,169.00 each year for the next five years. The cost of capital is 11.73%. What is the profitability index for the J-Mix 2000?

In: Finance