Answer:
The answer is a method
Explanation:
Answer:
class and self
Explanation:
class Bike:
def __init__(self, str, float):
self.color = str
self.price = float
Answer:
If( on_time == True) {
print("Coffee")
} else {
print("No Coffee")
}
Explanation:
Step 1 evaluate with a boolean variable if you are on time
If( on_time == True) {
Step 2 if true you have coffee
print("Coffee")
Step 3 if false you have not coffee
print("No Coffee")
Enter the length of a side: 5
***** *****
***** * *
***** * *
***** * *
***** *****
Answer:
Here is the JAVA program.
import java.util.Scanner; //Scanner class to take input from user
public class HollowFilledSquare {
public static void main(String[] args) { //start of main() function body
Scanner sc= new Scanner(System.in); // Scanner class object
System.out.print("Enter an integer to display a filled and hollow square "); //prompts user to enter an integer
int n = sc.nextInt(); // reads integer input from the user
StringBuilder filled = new StringBuilder(n);
// creates objects filled and hollow of class StringBuilder
StringBuilder hollow = new StringBuilder(n);
for (int i = 1; i <= n; i++) { // outer loop for length of the square
for (int j = 1; j <= n; j++) { // inner loop for width of square
filled.append("*"); //displays asterisks
if (i == 1 || i == n || j == 1 || j == n) // condition to display stars
{hollow.append("*");}
else
{ hollow.append(" "); } } // to display empty spaces
System.out.println(filled + " " + hollow);
// places hollow and filled squares next to each other
filled. delete(0, filled.length());
//removes characters from 0 to the length of filled square
hollow. delete(0, hollow.length());
//removes characters from 0 to the length of hollow square } } }
Explanation:
The program first prompts the user to enter an integer. It uses outer loop for length of the square and inner loop for width of square in order to display the asterisks. append () function is used to display the sequence of asterisks. delete () function removes the asterisks from the sequence of asterisks. String Builder is a class used for to create a string of n characters. It basically works like String but this is used to create modifiable objects.
The screen shot of the code along with the output is attached.
A Python program can be written to read an integer that is then used to print out two squares of that side length with asterisks, one filled and one hollow. The provided Python code uses nested loops and conditionals to generate the squares accurately.
To complete your request, we would need to write a program to read an integer input and utilize this integer value to generate two squares with asterisks, one filled and one hollow. Here is a simple Python program:
def print_squares(n):This program first prints a filled square and a hollow square using conditionals to distinguish between the edge and inner positions of the squares.
#SPJ3
Answer:
The formula is =OFFSET( A1, 7,3,1,1 )
Explanation:
Microsoft excel is a statistical and analytical tool for data management and analysis. Its working environment is called a worksheet. The worksheets are made up of rows and columns also known as records and fields respectively.
Functions like OFFSET in excel is used to return a cell or group of cells. It gets the position to turn by start getting a starting port, then the number of records below it and the fields after, then the length and width of cells to return.
syntax: =OFFSET( "starting cell", "number of rows below", "number of columns after", "height of cells to return", "width of cells to return" )
b. one month before program completion
c. a couple of weeks before program completion
d.Never, you don’t need to complete any paperwork to prepare for program completion
Answer:
d. Never, you don’t need to complete any paperwork to prepare for program completion
Explanation:
Program completion is depends on completion of your course work and successful thesis defense. If all the requirements to complete the program are successfully completed with required grades university/ Institute will automatically complete your program. In case you have any requirement left or any course having grade 'F' your program will not be considered as completed. In case if you want to improve some grade or revise some course you should write to the university that you want improve some course or grade.
So, there is no need to complete any paper work to prepare for program completion.
Answer:
The c# program for the scenario is given below.
using System;
public class Program2 {
double total = 0;
static void Main() {
Program2 ob = new Program2();
Console.WriteLine("Enter total energy used in kilo watts ");
int p;
p = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter type of customer ");
char t;
t = Convert.ToChar(Console.ReadLine());
ob.bill_calculator(p, t);
Console.WriteLine("Total charge for " + p + " kilo watts electricity for " + t + " customers is " + ob.total);
}
public void bill_calculator(int e, char c)
{
int first=500, second = 800;
double chg_one = 0.12, chg_two=0.15, chg_three = 0.16, chg_four = 0.20;
if(c == 'R')
{
if(e <= 500)
{
total = (e * chg_one);
}
else if(e > 500)
{
total = ( first * chg_one);
total = total + ((e-first) * chg_two);
}
}
if(c == 'B')
{
if(e <= 800)
{
total = (e * chg_three);
}
else if(e > 800)
{
total = ( first * chg_three);
total = total + ((e-second) * chg_four);
}
}
}
}
OUTPUT
Enter total energy used in kilo watts
1111
Enter type of customer
B
Total charge for 1111 kilo watts electricity for B customers is 142.2
Explanation:
The program takes user input for the type of customer and the amount of electric current used by that customer.
The two input values decide the rate at which total charge is calculated.
For residential customers, charges are divided into slabs of 500 or less and more than 500.
Alternatively, for business customers, charges are divided into slabs of 800 or less and more than 800.
User input is taken in main function.
Charges are calculated in the bill_calculator method which takes both user input as parameters.
If else block is used to calculate the charges.
No input validation is implemented as it is not mentioned in the question.
All code is written inside the class. An object is created of the class.
The methods outside main() are called using the object of the class.
The recommended approach for this:
(1) create a variable to hold the current sum and initialize it to zero,
(2) use a for loop to process each element of the list,
(3) test each element to see if it is an integer or a float, and, if so, add its value to the current sum,
(4) return the sum at the end.
student.py 1
Hef sum_lengths(value_list):
# Implement your function here. Be sure to indent your code block! Restore original file
Answer:
See explaination
Explanation:
def sum_lengths(value_list):
total = 0
for x in value_list:
if (type(x)==int) or (type(x)==float):
total += x
return total