[Solved] Why is my output in the form of 1.79214e-307 instead of a normal floating point number? [closed]

You are printing the wrong variable. notmemtot = totalnot(servcharge, testcharge, medcharge); cout << “The total bill is $” << membertot; should be notmemtot = totalnot(servcharge, testcharge, medcharge); cout << “The total bill is $” << notmemtot; But even easier (so you can’t make the mistake you made) would be not to use a variable in … Read more

[Solved] Join 2 elements of a list [closed]

To combine two items of two lists as string you need to iterate through both lists at the same time and concatenate the two items as strings. list1 = [1, 2, 3, 4] list2 = [‘a’, ‘b’, ‘c’, ‘d’] list3 = [str(x) + str(y) for x, y in zip(list1, list2)] print(list3) the output will be: … Read more

[Solved] How do you invoke a method? [closed]

public class Arraymini { public static void main(String [] args){ int [] testArray1= {1,6,3,9,2}; double [] testArray2= {2.3, 8.66, 6.5, -9.2}; printArray(testArray1); printArray(testArray2); } public static void printArray(int []k){ for(int i=0; i<k.length; i++){ System.out.println(k[i]+” “); } } public static void printArray(double[]g){ for(int i=0; i<g.length; i++){ System.out.println(g[i]+” “); } } } solved How do you invoke … Read more

[Solved] Create or open file in python [closed]

PEP8 suggests you to use: with open(‘test.txt’, ‘a+’) as f: f.write( “Your new content” ) The with statement is better because it will ensure you always close the file, even if an exception is raised. Example adapted from: http://docs.python-guide.org/en/latest/writing/style/#pep-8 solved Create or open file in python [closed]

[Solved] PHP generate json – list of categories [closed]

You can use an multi-dimensional array with the json_encode function to achieve this structure. $var = array( “contacts” => array ( array( “id” => 1, “name” => “foo” ), array( “id” => 2, “name” => “bar” ) ) ); echo json_encode($var); 4 solved PHP generate json – list of categories [closed]

[Solved] Python amount of days in a month with a given year and month? [closed]

You can do all sorts of things with the calendar module: import calendar year = int(raw_input(‘Enter year: ‘)) month = int(raw_input(‘Enter month number: ‘)) print(calendar.monthrange(year, month)[1]) This considers leap years just fine, too. Example: Enter year: 2012 Enter month number: 2 29 solved Python amount of days in a month with a given year and … Read more

[Solved] I am developing a hexadecimal to decimal converter

check this solution if you are going to develop it yourself. if fact it is already developed, you don’t have to invent one. String hexValue = “put your hex in quotes”; int decimalValue = Integer.parseInt(hexValue, 16); Hope it will help 4 solved I am developing a hexadecimal to decimal converter

[Solved] Is it possible to add Several bgcolor to one HTML page,Not background-color [closed]

It is not clear what you are trying to do, but you can setup multiple div as background like this: .element { position: relative; width: 300px; height: 300px; background: rgba(255, 0, 0, .5); } .background { position: absolute; top:0; right:0; bottom:0; left:0; } .background.bg1 { background: rgba(0, 0, 255, .5); } .background.bg2 { background: rgba(0, … Read more