Hello, here is the completed code you wanted. Every important statement is explained using comments. Please check and let me know if you have any doubts. Thanks.
PART 1
CODE
using System;
public class Program
{
public static void Main(string[] args)
{
//array holding values of
temperature
double[] weeklyTemp;
//initializing array
weeklyTemp = new double[7]{86.5,
89, 87.5, 75.5, 76.4, 74.3, 85.1};
//variables to store average and
sum of temperatures
double average, total = 0;
//loop to calculate total
temperature
for(int i = 0; i < 7; i++)
{
//calculating
total temperature
total = total +
weeklyTemp[i];
}
//calculating average
temperature
average = total / 7;
//printing average
temperature
Console.WriteLine("Average
temperature: {0:0.00} Fahrenheit", average);
}
}
OUTPUT
CODE SCREEN SHOT
PART 2
CODE
using System;
public class Program
{
public static void Main(string[] args)
{
//n
int n = 10;
//printing header
Console.WriteLine("n\tsquared");
//while loop
while(n > 0)
{
//printing
table
Console.WriteLine(n + "\t" + n * n);
//decrementing
n
n--;
}
}
}
OUTPUT
CODE SCREEN SHOT
PART 3, 4
CODE
using System;
public class Program
{
//method to calculate area of circle
public static double calculateareaOfCircle(double
radius)
{
//variable to store area
double area;
//calculating area
area = Math.PI * radius *
radius;
//returns area
return area;
}
public static void Main(string[] args)
{
//variables
double radius = 10, area = 0;
//calling
calculateareaOfCircle
area =
calculateareaOfCircle(radius);
//printing area
Console.WriteLine("Area of the
circle with radius " + radius + " is {0:0.00}", area);
}
}
OUTPUT
CODE SCREEN SHOT
PART 5
CODE
using System;
// Class Declaration
public class Student
{
//private variable
private String studentFullName;
//default constructor
public Student()
{
//initializing
studentFullName
this.studentFullName = "ALEX P
S";
}
//displayName method to display name of student
public void displayName()
{
//displaying student name
Console.WriteLine("Name: " +
this.studentFullName);
}
// Main Method
public static void Main(String[] args)
{
//instance of Student class
Student ob = new Student();
//calling displayName
ob.displayName();
}
}
OUTPUT
CODE SCREEN SHOT
please do it in C# language Q. 1 part 1 Create an array named weekly Temp...
Create a BoxFigure class that inherits RectangleFigure class BoxFigure Class should contain:- Height instance field- Default constructor -- that calls the default super class constructor and sets the default height to 0- Overloaded constructor with three parameters (length, width and height) – that calls the two parameterized super class constructor passing in length and width passed and sets the height to passed height.- setDimension method with three parameters (length, width, height) – call the super class setDimension and pass in...
Programming: Create a class called City with two public variables: a string to store the name of the city and a float to store the average temperature in Fahrenheit. Create one object of the class that you create and ask the user to enter the city name and the average temperature in Fahrenheit. Store these in the object of the class that you create. Then display the contents of the class. Once that is working, make the variables private and...
Write a C++ program for the instructions below. Please read the instructions carefully and make sure they are followed correctly. and please put comment with code! Problem:2 1. Class Student Create a "Hello C++! I love CS52" Program 10 points Create a program that simply outputs the text Hello C++!I love CS52" when you run it. This can be done by using cout object in the main function. 2. Create a Class and an Object In the same file as...
I need help for part B and C 1) Create a new project in NetBeans called Lab6Inheritance. Add a new Java class to the project called Person. 2) The UML class diagram for Person is as follows: Person - name: String - id: int + Person( String name, int id) + getName(): String + getido: int + display(): void 3) Add fields to Person class. 4) Add the constructor and the getters to person class. 5) Add the display() method,...
In a project named 'DogApplication', create a class called 'Dog' 1. declare two instance variables in 'Dog' : name (String type) age (int type) 2. declare the constructor for the 'Dog' class that takes two input parameters and uses these input parameters to initialize the instance variables 3. create another class called 'Driver' and inside the main method, declare two variables of type 'Dog' and call them 'myDog' and 'yourDog', then assign two variables to two instance of 'Dog' with...
Write a class called Student. The specification for a Student is: Three Instance fields name - a String of the student's full name totalQuizScore - double numQuizesTaken - int Constructor Default construtor that sets the instance fields to a default value Parameterized constructor that sets the name instance field to a parameter value and set the other instance fields to a default value. Methods setName - sets or changes the student name by taking in a parameter getName - returns...
In JAVA 1. Create a class called Rectangle that has integer data members named - length and width. Your class should have a default constructor (no arg constructor) Rectangle() that initializes the two instance variables of the object Rect1. The second overloading constructor should initializes the value of the second object Rect2. The class should have a member function named GetWidth() and GetLength() that display rectangle's length and width. OUTPUT: Rectl width: 5 Rectl length: 10 Enter a width :...
Key Takeaways -To create 2 groups of 4 students (8 students in total) -NEEDS random GPAs for each student -No arrays ------------------------------------- app.java, student.java, and group.java as requested below. Please use the diagram above to help answer the Question: Create a project that: Has a student class Instance variables for Firstname, last name , and age random generated GPA methods to return getinfo and semesterGPA Build upon the solutions of the previous labs (e.g., using app.java and student.java) You will...
How do I start this Java: Inheritance problem? • person.java • student.java • studentAthlete.java • app.java • Students should apply consistent indenting in all submissions. This can be done via the NetBeans Source menu. Contents person First name Last name app Creates 1 student-athlete object Hometown Retinfo) 1-Displays the complete information about the student-athlete object student New attributes Maior attributes getinfo) method from the superlas person Student-athlete student's rankine Overrides the method from the superclass student Video from Professor Fisher...
Application should be in C# programming language Create a class called SavingsAccount. Use a static variable called annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance, indicating the amount the saver currently has on deposit. Provide method CalculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12 – this interest should be added to savingsBalance. Provide static method setAnnualInterestRate to set the...