fork download
  1. /*Write the Java source code necessary to build a solution for the following problem:
  2. Changes in the economy have determined that for the EZ shipping company, a surcharge will be assessed on all packages that meet certain criteria. The surcharge is a function of the characteristics of the package and the zip code to which it is sent.
  3.  
  4.  
  5. If the first digit of the zip code is a "4," then there is an additional surcharge of 5% on the shipping cost. If the first digit of the zip code is a "6," then there is an additional shipping cost surcharge of 9% based on the weight of the package. For all other zip codes there is an additional shipping cost surcharge of 14%. Additionally, if the zip code is even, then there is an additional charge of 2% of the shipping cost.
  6.  
  7.  
  8. In addition to the surcharges, the regular charges for shipping are calculated as follows:
  9.  
  10.  
  11. For all weights under five pounds, the charge is $12.00.
  12.  
  13.  
  14. For weights over five pounds, the charge is calculated as follows:
  15. If length * width * height + weight is:
  16.   a. Between 5.1 and 15, the charge is 14.00
  17.   b. Between 15. 1 and 34, the charge is 17.00
  18.   c. Between 34. 1 and 45, the charge is 21.00
  19.   d. Between 45.1 and 60, the charge is 33.00
  20.   e. Greater than 60, the charge is 105.00
  21. Write a program that allows the user to input the zip code and the characteristics of the package then prints out the following:
  22. The zip code and dimensions of the package
  23. The shipping cost
  24. The surcharge
  25. The total shipping cost (shipping cost plus surcharge)
  26. */
  27.  
  28.  
  29. import java.util.*;
  30.  
  31.  
  32. public class shippingCharges{
  33.  
  34. public static double dimLength=0, dimWidth=0, dimWeight=0;
  35. public static Scanner stdIn = new Scanner(System.in);
  36.  
  37. public static void main(String[]args){
  38. System.out.println("Enter the height of the package :");
  39. stdIn = dimLenght.nextDouble();
  40. System.out.println("/nEnter the Width of the package :");
  41. stdIn = dimWidth.nextDouble();
  42. System.out.println("/nEnter the Weight of the package :");
  43. stdIn = dimWeight.nextDouble();
  44.  
  45.  
  46.  
  47. }
  48.  
  49. public static double calcShipping(double charge, double len, double wdth, double wght){
  50.  
  51. charge = (len*wdth)+wght;
  52. return charge;
  53. }
  54.  
  55. }
  56.  
  57.  
  58.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Visual Basic.Net Compiler version 0.0.0.5914 (Mono 2.4.2 - r)
Copyright (C) 2004-2008 Rolf Bjarne Kvinge. All rights reserved.


/home/mv25Sr/prog.vb (29,7) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (29,19) : Error VBNC30037: Symbol is not valid.
/home/mv25Sr/prog.vb (32,30) : Error VBNC90019: Expected '('.
Error recovery not implemented yet.
/home/mv25Sr/prog.vb (32,30) : Error VBNC90019: Expected 'Of'.
Error recovery not implemented yet.
Error recovery not implemented yet.
/home/mv25Sr/prog.vb (32,30) : Error VBNC90019: Expected ')'.
Error recovery not implemented yet.
/home/mv25Sr/prog.vb (32,30) : Error VBNC30205: Expected end of statement.
Error recovery not implemented yet.
/home/mv25Sr/prog.vb (32,30) : Error VBNC90019: Expected 'End'.
Error recovery not implemented yet.
/home/mv25Sr/prog.vb (32,30) : Error VBNC30205: Expected end of statement.
Error recovery not implemented yet.
/home/mv25Sr/prog.vb (32,30) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (34,18) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (34,62) : Error VBNC30037: Symbol is not valid.
/home/mv25Sr/prog.vb (35,18) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (35,57) : Error VBNC30037: Symbol is not valid.
/home/mv25Sr/prog.vb (37,18) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (37,36) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (38,15) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (38,64) : Error VBNC30037: Symbol is not valid.
/home/mv25Sr/prog.vb (39,14) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (39,39) : Error VBNC30037: Symbol is not valid.
/home/mv25Sr/prog.vb (40,15) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (40,65) : Error VBNC30037: Symbol is not valid.
/home/mv25Sr/prog.vb (41,14) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (41,38) : Error VBNC30037: Symbol is not valid.
/home/mv25Sr/prog.vb (42,15) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (42,66) : Error VBNC30037: Symbol is not valid.
/home/mv25Sr/prog.vb (43,14) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (43,39) : Error VBNC30037: Symbol is not valid.
/home/mv25Sr/prog.vb (47,6) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (49,18) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (51,15) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (51,33) : Error VBNC30037: Symbol is not valid.
/home/mv25Sr/prog.vb (52,15) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (52,22) : Error VBNC30037: Symbol is not valid.
/home/mv25Sr/prog.vb (53,6) : Error VBNC30203: Not valid as identifier.
/home/mv25Sr/prog.vb (55,2) : Error VBNC30203: Not valid as identifier.
There were 35 errors and 0 warnings.
Compilation took 00:00:00.6456410
stdout
Standard output is empty