How to fix Error in plot.new() : figure margins too large, Scatter plot Read more
C Programming 6.3.2: Function stubs: Statistics. Define stubs for the functions called by the below main(). Each stub should print "FIXME: Finish FunctionName()" followed by a newline, and should return -1. Example output: FIXME: Finish GetUserNum() FIXME: Finish GetUserNum() FIXME:... Read more
Using the program shown in Figure 3.35, explain what the output will be at lines X and Y Answer The output would be CHILD: 0 CHILD: -1 CHILD: -4 CHILD: -9 CHILD: -16 PARENT: 0 PARENT: 1 PARENT: 2 PARENT:... Read more
Print air_temperature with 1 decimal point followed by C. Sample output from given program: 36.4c Answer #Read the value from keyboard and parse to float#assign the value to air_temperatureair_temperature=float(input())#Print the air_temperature with one decimal place to right with Cprint('%.1fC'%air_temperature)#where f... Read more
Python - files: find a solution for each following: Answer #1) host=open("hostdata.txt", "r") #2) winter=open("winter2003.txt", "r") spring=open("spring2003.txt", "r") summer=open("summer2003.txt", "r") fall=open("fall2003.txt", "r") #3) summary=open("yearsummary.txt", "w") #4) pi = open("pi","w+") pi.write("3.14159") pi.close() #5) data1 = open("data1.txt","r") data2 = open("data2.txt","w+") for line... Read more
Write code to complete PrintFactorial()'s recursive case. Sample output if userVal is 5: 5! = 5 4 3 2 1 = 120 Answer #include <stdio.h>void PrintFactorial(int factCounter, int factValue){ int nextCounter = 0; int nextValue = 0; if (factCounter ==... Read more
Write code to complete DoublePennies()'s base case. Sample output for below program: Number of pennies after 10 days: 1024 #include <stdio.h>// Returns number of pennies if pennies are doubled numDays timeslong long DoublePennies(long long numPennies, int numDays){long long totalPennies =... Read more
Given that d refers to a dictionary, change the value mapped to by the key 'Monty' to 'Python'. Write in Python Answer The required statement is as follows: d['Monty'] = 'Python' Explanation: The general syntax to set the value mapped... Read more
C Program - Assign negativeCntr with the number of negative values in the linked list, including the list head #include <stdio.h>#include <stdlib.h>typedef struct IntNode_struct {int dataVal;struct IntNode_struct* nextNodePtr;} IntNode;// Constructorvoid IntNode_Create(IntNode* thisNode, int dataInit, IntNode* nextLoc) {thisNode->dataVal = dataInit;thisNode->nextNodePtr =... Read more
Write the printItem() method for the base class. Sample output for below program: Last name: Smith First and last name: Bill Jones // ===== Code from file BaseItem.java =====public class BaseItem {protected String lastName;public void setLastName(String providedName) {lastName = providedName;return;}//... Read more
PYTHON: A software company sells a package that retails for $99. Quantity discounts are given according to the following table: Write a program that asks the user to enter the number of packages purchased. The program should then display the... Read more
(Java) Complete the method definition to output the hours given minutes. Output for sample program: 3.5 secretID.concat(spaceChar); secretID.concat(lastName);import java.util.Scanner;public class CombiningStrings { public static void main (String [] args) { String secretID = "Barry"; String lastName = "Allen"; char spaceChar... Read more
5.6 Warm up: Parsing strings (Java) Answer import java.util.Scanner; public class ParseStrings { public static void main(String[] args) { Scanner sc = new Scanner(System.in);//to read input from user String str;//to hold strig entered by user System.out.println("Enter input string");//asking user to... Read more
BMI Formula: Write a Python Program that asks the user for weight and height and then displays weight class based on BMI Answer # define functions def bmi(weight, height): return (weight*703)/(height*height) # take input from the user print("BMI calculate") weight... Read more
C program, Assign negativeCntr with the number of negative values in the linked list, including the list head. Answer To get the count the negative values present in the linked list, the following steps: In the main() function, at the... Read more
a. Remove the smallest element from the set, s. If the set is empty, it remains empty. b. Create a dictionary that maps the first n counting numbers to their squares. Associate the dictionary with the variable squares. Answer a.... Read more
Define the missing method. Use "this" to distinguish the local member from the parameter name. Answer // ===== Code from file CablePlan.java ===== public class CablePlan { private int numDays; // FIXME: Define setNumDays() method, using "this" implicit parameter. public... Read more
In Java; Set hasDigit to true if the 3-character passCode contains a digit. Answer import java.util.Scanner; public class CheckingPasscodes { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); boolean hasDigit; String passCode; hasDigit = false;... Read more
Compute the average kids per family. Note that the integers should be type cast to doubles. import java.util.Scanner; public class TypeCasting { public static void main (String [] args) { int numKidsA = 1; int numKidsB = 4; int numKidsC... Read more
Write an expression to detect that the first character of userinput matches firstletter. Answer Explanation: - As in the provided code we do not prompt user to enter string and charater, instead we directly hard code and initialize the variables... Read more
Write nested loops to print a rectangle. Sample output for given program: * * * * * * Answer #Variable declaration num_rows=2 num_cols=3 #For loop for number of rows for p in range(num_rows): #For loop for number of columns for... Read more
Write a method printshampooinstructions() with int parameter numcycles and void return type Answer import java.util.Scanner; public class ShampooMethod { static void printShampooInstructions(int numCycles) { if (numCycles < 1) { System.out.println("Too few.."); } else if (numCycles > 4) { System.out.println("Too many..");... Read more
Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a newline. Ex: printFeetInchShort(5, 8) prints: 5' 8" Answer import java.util.Scanner; public class HeightPrinter { public static void printFeetInchShort(int numFeet, int... Read more
Complete the method definition to output the hours given minutes. Output for sample program: 3.5 Answer import java.util.Scanner; public class HourToMinConv { public static void outputMinutesAsHours(double origMinutes) { System.out.print(origMinutes / 60); } public static void main(String[] args) { Scanner scnr... Read more