Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
thumb_up100%
Please help how do I put all information in line during the output both the code and my example are presented below in the photos
Transcribed Image Text:O Mainjaa>
import java.io.File;
import java.io.FileNotFoundException;
import java.io.Filewriter;
iport java.io.IOException;
1
2
3\
4.
import java.util.ArrayList;
import java.util.Scanner;
7
public class Main
{
10
static public double caleTax (double salary, double taxRate)
11
double taxOwed- 0;
taxOwed = (salary taxRate) / 180;
return taxOwed;
12
13
14
15
16
Run | Debug
public static void main(Strinc[] args) throws I0Exception
17
18
19
Arraylist<Double> salary - new Arraylist<Double>();
ArrayList<String> name - new ArrayList<String>();
Arraylist<String> company_name - new Arraylist<String>();
// int lines- 1;
20
21
22
23
24
try{
File myFile - new File(pathname: "taxpayer.txt");
Scanner fileReader- new Scanner (myFile);
25
26
Ln 5, Col 28 Spaces 4 UTF-8
O Mainjava X
Ftapayer.bt
Fuxintbt
O Mainjava>-
24
try{
File myFile - new File(pathname: "taxpayer.txt");
Scanner fileReader - new Scanner (myFile);
25
26
27
while(fileReader.hasNextline()){
28
String data - fileReader.nextLine();
29
System.out.printin(data);
String[] datahrr - data. split (regex: ", ");
name.add (dataarr[0] + " "+ dataArr[1] );
company_name.add (dataarr[2]);
double sal - Double.parseDouble(dataarr[3]);
salary.add(sal);
// if(lines X 3 -- 1 ){
30
31
32
33
34
35
36
//
name.add(data);
// Jelse if(lines % 3 -- 2){
//
// Jelse(
//
//
37
38
company_name. add(data);
39
40
double sal - Double.parseDouble(data);
41
salary.add (sal);
42
//)
43
// lines++;
44
45
filekeader.close();
46
}catch (FileNotFoundException e){
47
System.out.println(x: "File with given name not found");
e.printStackTrace();
48
49
}
50
Ln 5, Col 28 Spaces 4 UTF-8
O Mainjava X
F taxpayer t
Etaintbt
O Mainjava>.
48
e.printStackTrace();
49
50
try(Fileiriter myriter - new Filewriter(fileName: "taxinf.txt", append: true)
51
52
System.out.println(x: "Records started in file .....");
for (int i-0; i<name.size();i++)
53
54
55
String nameP- name.get (i);
String companyName- company_name.get (i);
double salaryP- salary.get(i);
double taxRate- 0, taxOwed- 0;
if(salary.get(i) <- 10000000) (
taxRate- 40;
Jelse(
taxRate- 53;
56
57
58
59
60
61
62
63
64
taxOwed - calcTax(salary.get (i), taxRate);
String tax - String.valueof (taxOwed);
myliriter.write (nameP+"\n" + companyName + "\n" +salaryP + "\n" + tax + "\n");
System.out.println(nameP+"\n"+companyName);
65
66
67
68
69
70
71
72 1
Transcribed Image Text:As a bonus, Revenue Canada is willing to pay more for your program if you were to display
the results on the screen as well. The display should look similar to:
Kevin Loughrey, Thompson Creek Metals Co. Inc. , 3,356,000ドル.00 , 1,342,400ドル.00
James Balsillie, Research In Motion Ltd., 141,594,333ドル.00 , 75,044,996ドル.49
Prem Watsa , Fairfax Financial Holdings Ltd. , 619,000ドル.00 , 247,600ドル.00
Richard Clark, Red Back Mining Inc. , 3,310,667ドル.00 , 1,324,266ドル.80
John Shackleton, Open Text Corp. , 4,861,667ドル.00 , 1,944,666ドル.80
John Wright, Petrobank Energy and Resources Ltd. , 4,353,333ドル.00, 1,741,333ドル.20
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
Step by stepSolved in 2 steps
Knowledge Booster
Background pattern image
Similar questions
- Write code (python) to generate and display an image like this. Be sure to get the location of the center correct, the number of rings, and the number of pixels in vertical and horizontal direction. Don’t worry about the exact name of libraries to import in pythonarrow_forwardHello this is in python! Please write this code of merging two images together. Please read the rules. The inputs to your function are: (i) image left: grace\_1.png (size: 350 Rows X 340 Cols), (ii) image right: grace\_2.png (size: 350 Rows X 340 Cols), (iii) image column (c) at which the images should be merged. image_op/operations.py: Edit the function merge Define a new image as follows: the first c columns (default value = 155) should be equal to the first c columns of the left image (grace_1.png). The remaining columns should be equal to the columns greater than c from the right image (grace_2.png). def merge(self, image_left, image_right, column):"""Merge image_left and image_right at column (column)image_left: the input image 1image_right: the input image 2column: column at which the images should be mergedreturns the merged image at column"""# add your code here # Please do not change the structurereturn image_left # Currently the original image is returned, please...arrow_forwardAssignment: Create a surface and contour plot of function z=f(x,y) [-5,5] by [-5,51. Take a pick to plot from any of the choices below. (01) f(x,y) = x*y**3-y*x**3 (02) f(x,y) = (x**2+3*y**2) *exp(-x**2-y**2) (03) f(x, y) = -1/(x**2+y**2) (04) f(x, y) = cos(abs(x)+abs(y)) - Use at least 500 points in each direction to discretize domain and create the grid. - Make the surface plot red and without grid lines. - For contour plot, specify contour levels to go from minimum and maximum Z values on the entire domain and include at least 15 contour levels. - Pick a colormap you like I ## Create data import numpy as np import pyvista as pvarrow_forward
- Matlab coding pleasearrow_forwardUse python code with "def drawItem(img,item,row,col):" but without using cv2,PIL or numpy drawItem(canvas, item, row, col) - Modify canvas by drawing the non-white pixels of the item (intended to be the image of a word) onto canvas. Row and col represent the top left pixel of canvas where the item (the item's top left 0,0 pixel) should be placed. Canvas and item are 2D images of RGB pixels. This function should assume that the canvas image is large enough to contain the item img in the row col indicated; row and col do NOT need to be validated.arrow_forwardCan you please explain more and the provided image is not showing as expectedarrow_forward
- a) Manually (you do not need do any of this in code) create a graphical user interface such as the one depicted in Figure 1. Use the value provided in the CSV file on Canvas. b) Minimum requirements are to always ask for 3 assignments – for this, you skip this step. For bonus credit, prompt the user to input the number of assignments to calculate statistics for. In this case you would need to prompt the user via an input box for the total number of deliverables for which summary statistics will be calculated. You must verify that the user enters a value that can represent a valid integer number in the range [1, 6]. If the user enters a value that does not represent a number, the user enters a valid value but the value is outside of the allowed range, or the user enters a non-integer value, your program must display an error message box. Once the user acknowledges the error by pressing the "OK" button on the message box, your program must continue to display the input box asking for...arrow_forwardConstruct a color palette as shown in the fig below. Your output shows 64 color combinations. Paste the MATLAB CODE as Text in the space provide and attach a screenshot of the image. Note: Do not try to get the same sequence of colors)arrow_forwardno code is needed question: Find the second-order derivative of the third horizontal line from the following image [ Hint : Use Padding] 6 6 6 5 4 3 1 1 5 4 3 2 1 1 1 1 6 6 5 4 3 1 1 1 1 1 1 1 1 1 6 6 6 6 6 6 6 6 6 5 4 3 2 1 1 1 1 1 1 6 6 6 6 6 5 4 3 2 1 6 6 6 6 6arrow_forward
- LAB ASSIGNMENTS, CONT. loop-1.py program - For each item below, include print statements that say what each loop is doing. Several code samples in the PPT are close to what you need to produce this output (adapt model). Write a loop that prints all of the numbers from O through 5. Write a loop that prints all of the numbers from 1 through 20. Write a loop that prints all of the odd numbers from 37 through 53. Write a loop that prints 10, 20, 30, 40, 50, 60. Write a loop that prints all of the even numbers from 0 through 24. Write a loop that prints numbers counting down from 30 through 20. 130 120arrow_forwardUse this code to run this example attached in the image:arrow_forwardConvert the decimal number 34492.696289062 into a HEX NUMBER showing the steps (Note : The problem should be solved in separate paper with steps and scanned copy should be submitted along with other answers Final answer must be entered in the boxes provided below. For Hexadecimal digits from A to F, enter their equivalent decimal value in the corresponding box; do not enter the letter; (For eg, if answer is A, ther enter 10, for B, enter 11 and so on) Enter only one digit in each box. Also fill the unused boxes with zeros) However, in your written submissions, use the letters A to F instead of the values The integer part = The fractional part =arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Text book imageComputer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONText book imageComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceText book imageNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Text book imageConcepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningText book imagePrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationText book imageSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY