Questions
Complete the following assignment in C programming language. 1. Declare the following float variables: -Maximum exam...

Complete the following assignment in C programming language.

1. Declare the following float variables:

-Maximum exam score, user's exam score, and percentage.

2. Ask the user to input data into your variables, such as:

-"What is the max score of your exam:"

-"What was your score:"

3. Use if statements to validate user inputs. For example, score received should not be more than maximum possible score.

-Display an error message when the user enters invalid data.

-You can restart the program if use enters invalid input by pressing the RESET button on the processor board.

4. Build your Software logic to calculate the percentage and the letter grade.

-Hint: Store your letter grade to a char variable.

-Hint: Use if and else if statements. Scan from A to D leaving F to else statement.

5. Print out summary for the user:

-If the user's grade is either B, C, or D, print-out how many percent points the user is away from the next letter grade.

-Hint: (Score % 10) will tell you the remainder. If grade is B, C or D, calculate the remainder and subtract from 10.

-Example print-out:

-"You scored a B, and you were 3 percent away from the next letter grade."

In: Computer Science

C++ Class involving union. The goal is to overload the function: void Bag<T>::operator+=(const Bag<T>& a_bag) //...

C++ Class involving union.

The goal is to overload the function:

void Bag<T>::operator+=(const Bag<T>& a_bag)

// The union of two sets A and B is the set of elements which are in A, in B, or in both A and B. For instance, Bag<int> bag1 = 1,2,3 and Bag<int> bag2 = 3,4,5 then bag1+=bag2 should return 1,2,3,4,5.

//Since type is void, it should not return an array.

#include <iostream>
#include <string>

#include <vector>
using namespace std;

template<class T>
class Bag
{
public:
    Bag();
    int getCurrentSize() const;
    bool isEmpty() const;
    bool add(const T& new_entry);
    bool remove(const T& an_entry);
    /**
     @post item_count_ == 0
     **/
    void clear();
    /**
     @return true if an_etry is found in items_, false otherwise
     **/
    bool contains(const T& an_entry) const;

    /**
     @return the number of times an_entry is found in items_
     **/
    int getFrequencyOf(const T& an_entry) const;

    /**
     @return a vector having the same cotntents as items_
     **/
    std::vector<T> toVector() const;

    void display() const;  // displays the output 

    void operator+=(const Bag<T>& a_bag); //DO NOT CHANGE RETURN TYPE

protected:
    static const int DEFAULT_CAPACITY = 200;  //max size of items_
    T items_[DEFAULT_CAPACITY];              // Array of bag items
    int item_count_;                         // Current count of bag items
    int getIndexOf(const T& target) const;


};
template<class T>
Bag<T>::Bag(): item_count_(0)
{
}  // end default constructor

template<class T>
int Bag<T>::getCurrentSize() const
{
    return item_count_;
}  // end getCurrentSize

template<class T>
bool Bag<T>::isEmpty() const
{
    return item_count_ == 0;
}  // end isEmpty


template<class T>
bool Bag<T>::add(const T& new_entry)
{
    bool has_room = (item_count_ < DEFAULT_CAPACITY);
    //bool notDup = items_.getFrequencyOf(new_entry) == 0; 
    if (has_room) //&& notDup) 
    {
        items_[item_count_] = new_entry;
        item_count_++;
        return true;
    }  // end if

    return false;
}  // end add

template<class T>
void Bag<T>::display() const {
    for(int x = 0; x < item_count_;x++)
        cout << items_[x] << ", "; 
}


/**
 @return true if an_etry was successfully removed from items_, false otherwise
 **/
template<class T>
bool Bag<T>::remove(const T& an_entry)
{
   int found_index = getIndexOf(an_entry);
    bool can_remove = !isEmpty() && (found_index > -1);
    if (can_remove)
    {
        item_count_--;
        items_[found_index] = items_[item_count_];
    }  // end if

    return can_remove;
}  // end remove


/**
 @post item_count_ == 0
 **/
template<class T>
void Bag<T>::clear()
{
    item_count_ = 0;
}  // end clear

template<class T>
int Bag<T>::getFrequencyOf(const T& an_entry) const
{
   int frequency = 0;
   int cun_index = 0;       // Current array index
   while (cun_index < item_count_)
   {
      if (items_[cun_index] == an_entry)
      {
         frequency++;
      }  // end if

      cun_index++;          // Increment to next entry
   }  // end while

   return frequency;
}  // end getFrequencyOf

template<class T>
bool Bag<T>::contains(const T& an_entry) const
{
    return getIndexOf(an_entry) > -1;
}  // end contains

template<class T>
std::vector<T> Bag<T>::toVector() const
{
   std::vector<T> bag_contents;
    for (int i = 0; i < item_count_; i++)
        bag_contents.push_back(items_[i]);

   return bag_contents;
}  // end toVector
template<class T>
void Bag<T>::operator+=(const Bag<T>& a_bag)

{}

In: Computer Science

edit the code to make sure that if the user enter any city coordinates out the...

edit the code to make sure that if the user enter any city coordinates out the ranges ( x and y should be between 1 and 25). Also write the calc_plant() method in different way.

import java.io.*;
import java.util.*;
public class State {
  
private int citi1x,citi1y;
private int pop1;
private int citi2x,citi2y;
private int pop2;
private int citi3x,citi3y;
private int pop3;
private int citi4x,citi4y;
private int pop4;
private int plantx,planty;
public int getCity1X(){
return citi1x;
}
public int getCity1Y(){
return citi1y;
}
public int getCity2X(){
return citi2x;
}
public int getCity2Y(){
return citi2y;
}
public int getCity3X(){
return citi3x;
}
public int getCity3Y(){
return citi3y;
}
public int getCity4X(){
return citi4x;
}
public int getCity4Y(){
return citi4y;
}
public void setCity1(int a, int b){
citi1x = a;
citi1y = b;
}
public void setCity2(int a, int b){
citi2x = a;
citi2y = b;
}
public void setCity3(int a, int b){
citi3x = a;
citi3y = b;
}
public void setCity4(int a, int b){
citi4x = a;
citi4y = b;
}
public void setPop1(int a){
pop1 = a;
}
public void setPop2(int a){
pop2 = a;
}
public void setPop3(int a){
pop3 = a;
}
public void setPop4(int a){
pop4 = a;
}
public int getPop1(int a){
return pop1;
}
public int getPop2(int a){
return pop2;
}
public int getPop3(int a){
return pop3;
}
public int getPop4(int a){
return pop4;
}
public int getPlantX(){
return plantx;
}
public int getPlantY(){
return planty;
}
public void setPlantX(int a){
plantx = a;
}
public void setPlantY(int a){
planty = a;
}
public void read_input(){
int x,y;
int pop;
Scanner sc = new Scanner(System.in);
do {
System.out.print("Enter X and Y for city 1: ");
x = sc.nextInt();
y = sc.nextInt();
} while ((x < 1 || x > 25) && (y < 1 && y > 25));
setCity1(x,y);
System.out.print("Enter population for city 1: ");
pop = sc.nextInt();
setPop1(pop*1000);
do {
System.out.print("Enter X and Y for city 2: ");
x = sc.nextInt();
y = sc.nextInt();
} while ((x < 1 || x > 25) && (y < 1 && y > 25));
setCity2(x,y);
System.out.print("Enter population for city 2: ");
pop = sc.nextInt();
setPop2(pop*1000);

do {
System.out.print("Enter X and Y for city 3: ");
x = sc.nextInt();
y = sc.nextInt();
} while ((x < 1 || x > 25) && (y < 1 && y > 25));
setCity3(x,y);
System.out.print("Enter population for city 3: ");
pop = sc.nextInt();
setPop3(pop*1000);
do {
System.out.print("Enter X and Y for city 4: ");
x = sc.nextInt();
y = sc.nextInt();
} while ((x < 1 || x > 25) && (y < 1 && y > 25));
setCity4(x,y);
System.out.print("Enter population for city 4: ");
pop = sc.nextInt();
setPop4(pop*1000);
  
}

public void calc_plant(){

double min = 100000;
for (int i = 1; i<=25; i++){
  
for (int j = 1; j<=25; j++){
  
double unhappy1 = 0;
double unhappy2 = 0;
double unhappy3 = 0;
double unhappy4 = 0;
  
if ((i == citi1x && j == citi1y) || (i == citi2x && j == citi2y) || (i == citi3x && j == citi3y) || (i == citi4x && j == citi4y))
continue;
double dist = Math.sqrt((i-citi1x)*(i-citi1x) + (j-citi1y)*(j-citi1y));
if (dist <= 2){
unhappy1 = 10000000;
}
else {
unhappy1 = pop1/dist;
}
dist = Math.sqrt((i-citi2x)*(i-citi2x) + (j-citi2y)*(j-citi2y));
if (dist <= 2){
unhappy2 = 1000000;
}
else {
unhappy2 = pop2/dist;
}
dist = Math.sqrt((i-citi3x)*(i-citi3x) + (j-citi3y)*(j-citi3y));
if (dist <= 2){
unhappy3 = 1000000;
}
else {
unhappy3 = pop3/dist;
}
dist = Math.sqrt((i-citi4x)*(i-citi4x) + (j-citi4y)*(j-citi4y));
if (dist <= 2){
unhappy4 = 1000000;
}
else {
unhappy4 = pop4/dist;
}
double unhappy = (unhappy1 + unhappy2 + unhappy3 + unhappy4)/(pop1+pop2+pop3+pop4);
  
if (unhappy < min){
min = unhappy;
plantx = i;
planty = j;

}
}
}
  
}
  
public void display_map(){
for (int i = 1; i <=25; i++){
for (int j = 1; j <=25; j++){
if (i == citi1x && j == citi1y)
System.out.print("C1");
else if (i == citi2x && j == citi2y)
System.out.print("C2");
else if (i == citi3x && j == citi3y)
System.out.print("C3");
else if (i == citi4x && j == citi4y)
System.out.print("C4");
else if (i == plantx && j == planty)
System.out.print("PP");
else
System.out.print("<>");
}
System.out.println();
}
System.out.println();
}


}

import java.util.Scanner;

public class StatePlant {
   public static void main(String[] args){
  
   Scanner sc = new Scanner(System.in);
   State s = new State();
   s.read_input();
   s.calc_plant();
   System.out.println("Locate the plan at : " + s.getPlantX() + " " +s.getPlantY() );
   System.out.println("Enter 1 to view a Map of the scenario, or 0 to exit:");
   String inp = sc.nextLine();
   if (inp.charAt(0) == '1'){
   s.display_map();
   }
  
   }
}

Thank you so much:)

In: Computer Science

Hi, please could someone be of assistance with this assignment for me. Thank you The objective...

Hi, please could someone be of assistance with this assignment for me. Thank you

The objective of this assignment is to practice the use of control objects in GUI design.
You are required to create a 4- function calculator. See pic below.

Calculator.png



The calculator should have buttons for all 10 numbers, the decimal point, the four operations (+,-,/,*), an equal “=” button, a "main display" (TextBox or RichTextBot), a backspace button and a clear “C” button.
When you create your controls, you need to give them proper names (e.g. ButtonOne, ButtonResult, ButtonClear,etc)
The only programming in this assignment is

  • To make sure that whenever a number button is clicked, that number will appear in the mainDiaply
    • e.g. if the user click 3, then the number 3 will appear. If the user then clicks 4, then 34 will appear.
    • make sure that include fractional numbers like "5.44", this means that you need to activate the '.' button
  • If the user clicks on the 'C' button, the main Display will be cleared

In: Computer Science

C++ exercise: The statements in the file main.cpp are in incorrect order. using namespace std; #include...

C++ exercise:

The statements in the file main.cpp are in incorrect order.

using namespace std;

#include <iostream>


int main()
{
string shape;
double height;
#include <string>
  
cout << "Enter the shape type: (rectangle, circle, cylinder) ";
cin >> shape;
cout << endl;
  
if (shape == "rectangle")
{
cout << "Area of the circle = "
<< PI * pow(radius, 2.0) << endl;
  
cout << "Circumference of the circle: "
<< 2 * PI * radius << endl;
  
cout << "Enter the height of the cylinder: ";
cin >> height;
cout << endl;
  
cout << "Enter the width of the rectangle: ";
cin >> width;
cout << endl;
  
cout << "Perimeter of the rectangle = "
<< 2 * (length + width) << endl;
double width;
}
  
cout << "Surface area of the cylinder: "
<< 2 * PI * radius * height + 2 * PI * pow(radius, 2.0)
<< endl;
}
else if (shape == "circle")
{
cout << "Enter the radius of the circle: ";
cin >> radius;
cout << endl;
  
cout << "Volume of the cylinder = "
<< PI * pow(radius, 2.0)* height << endl;
double length;
}
return 0;

else if (shape == "cylinder")
{
double radius;
  
cout << "Enter the length of the rectangle: ";
cin >> length;
cout << endl;
  
#include <iomanip>
  
cout << "Enter the radius of the base of the cylinder: ";
cin >> radius;
cout << endl;
  
const double PI = 3.1416;
cout << "Area of the rectangle = "
<< length * width << endl;
else
cout << "The program does not handle " << shape << endl;
cout << fixed << showpoint << setprecision(2);
#include <cmath>
}

Rearrange the statements so that they prompt the user to input:

  • The shape type (rectangle, circle, or cylinder)
  • The appropriate dimension of the shape.

Note: For grading purposes place the cylinder height statement before the radius statement.

The program then outputs the following information about the shape:

  • For a rectangle, it outputs the area and perimeter
  • For a circle, it outputs the area and circumference
  • For a cylinder, it outputs the volume and surface area.

Use 3.1416 as the constant value for any calculations that may need \piπ.

After rearranging the statements, your program should be properly indented.

In: Computer Science

All Code should be written in C: 1. Write a C program which prompts the user...

All Code should be written in C:

1. Write a C program which prompts the user to enter two integer values. Your program should then print out all numbers between 1 and 1000 that are divisible by both of those numbers.

2. Modify your program from question 1 such that the first 1000 numbers that are divisible by both numbers are printed out, instead of numbers up to 1000.

3. Using dynamic memory, allocate memory for an array of 100 floating point numbers. Fill this array with random numbers between 0 and 1, and print them to the screen. HINT: Use RAND_MAX, which represents the largest possible value returned by the rand() function.

4. Modify question 3 such that the program writes the values to a file called "floats.txt" in text format, one per line, instead of to the screen

In: Computer Science

All Code should be written in C: 1. A perfect number is defined as a number...

All Code should be written in C:
1. A perfect number is defined as a number whose proper divisors (factors not including the number itself) add up to the same number. For example, 28 is a perfect number because its perfect divisors are 1, 2, 4, 7, 14, which add up to 28. Write a C function called is_perfect that takes a since integer as input, and returns 1 if the number is perfect, or 0 otherwise.

2. Using the function you wrote in Q1, write a C program to print out all the perfect numbers between 1 and 10000. There are only 4 such numbers, the largest being 8128.

3. Write your own version of the strcpy() function, called mystrcpy(). This function should take two strings (char pointers) as input, and copy the second string into the first. Test that your function works properly.

4. Write a C function called strdelete() which takes a string (char pointer) and a character as input. The function should then remove any instance of the character from the string. This should be done by shifting all the other characters down one position in the array so the string becomes shorter. For example strdelete("hello world", 'o') will result in the string being "hell wrld".

In: Computer Science

how can i get the code for this problem in visual basic? Create a Windows Forms...

how can i get the code for this problem in visual basic? Create a Windows Forms applications called ISP (Internet Service Provider) Project. You must enter the number of hours for the month and select your desire ISP package. An ISP has three different subscription packages for it's customers:

Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2 per hours.
Package B: For $13.95 per month 20 hours of access are provided. Additional hours are $1 per hours.
Package C: For $19.95 per month unlimited access is provided.

The program should also calculates and display the amount of money Package A customers would save if they purchased Package B or C, and the amount of money Package B customers would save if they purchase Package C. If there would be no savings, no message should be displayed.
thank you

can the options be display without using a radio button for the choose

In: Computer Science

Program 3.5 - Conversion Program   - NOW using cin statements to gather input from user Concepts...

Program 3.5 - Conversion Program   - NOW using cin statements to gather input from user

Concepts Covered:  Chapter 2 – cout ,   math, data types, Chapter 3 , gathering both numeric & string input from user

Programs 2-21, 2-22, 2-23, 2-28 should help with math and programs 3.5, 3.17 and 3.19 should help you with the new concepts introduced with this program.

Program Purpose:  To help you understand the concept of using both proper numeric variables and string variables. To give you practice using the C++ math operators. To give you practice getting both numeric input and string input from a user. To give you practice overriding the default behavior of C++ for numeric formatting. Lastly, to appreciate the flexibility of the cout object by passing it string variables, string literals, and numeric variables.

Background:  Your instructor is an avid (some would say obsessed) bicyclist.  Rides of 40 to 50 miles are not uncommon. Your instructor also uses an indoor training program called Zwift. It uses the metric system which is kilometers biked (instead of miles), and meters climbed (instead of feet).     You need to help out your metrically challenged professor and write a conversion program that converts kilometers to miles and meters to feet.

For example, if I told some of my non-biking friends that I rode 40 kilometers, many of them would be impressed.  Well, in miles that is only 24.8 miles.   Conversely, if I told them I climbed 1000 meters they may not be impressed.  But, 1000 meters is 3,280 feet which is not too shabby here in the Midwest.

Oh, did I mention, this also applies to runners, especially in terms of kilometers.

  

So your job commission is to write a C++ program which will convert kilometers to miles and meters to feet.

PROGRAM SPECIFICATIONS:

Insert program heading with your name, course, section, program name, AS WELL AS brief documentation of program purpose at the top of your program.

Create your c++ code.

INPUT SECTION

Create 4 numeric variables to hold the following:  meters, feet, kilometers, and miles.

Create 2 string variables: one to hold the activity type:  biking or running and the other to hold a person’s name.

Prompt the user for their name. You should get the user's full name! Example   Jimmy C   or John Bonham

Prompt the user (using their name) for which activity they did. - biking or running

Prompt the user for how many kilometers

Prompt the user for how many meters they climbed

PROCESSING SECTION

Perform the necessary math operations to convert kilometers to miles and meters to feet.

Kilometers to miles formula:

1 kilometer is equal to 0.621371 miles (often shortened to .62). 1 mile is equal to 1.609344 kilometers. Thus, to convert kilometers to miles, simply multiply the number of kilometers by 0.62137.

Meters to feet formula:

Multiply any meter measurement by 3.28 to convert to feet. Since one meter = 3.28 feet, you can convert any meter measurement into feet by multiplying it by 3.28.

1 meter x 3.28 = 3.28 feet

5 meters x 3.28 = 16.4 feet

2.7 meters x 3.28 = 8.856 feet

OUTPUT SECTION

Using cout statements, display the output listing name, activity, kilometers, miles, meters and feet. For formatting of numeric variables, use 2 digits of precision to right of decimal point.with values shown above.

In: Computer Science

There are two calsses: node.py and a5.py. The a5.py contains three important methods: Length -> Outputs...

There are two calsses: node.py and a5.py. The a5.py contains three important methods:

  • Length -> Outputs the length of the linked list
  • Insert -> Inserts an element into the linked list
  • PrintStructure -> Prints the entire linked list starting from the head

The task is to fill in these methods given in the a5.py. Hints are given to you inside the a5.py class so make sure to check them out. Note that one of the important concepts in this example is that when a new element is inserted into the list, it gets inserted into it’s appropriate (sorted) position. Please take a look at the examples to see how random values are inputted and the result is sorted.

Please enter a word (or just hit enter to end): bottle

Please enter a word (or just hit enter to end): a

Please enter a word (or just hit enter to end): water Please enter a word (or just hit enter to end): of Please enter a word (or just hit enter to end):

The structure contains 4 items: a bottle of water

Please enter a word (or just hit enter to end): Ana

Please enter a word (or just hit enter to end): Bill

Please enter a word (or just hit enter to end): car

Please enter a word (or just hit enter to end): algorithm Please enter a word (or just hit enter to end): button Please enter a word (or just hit enter to end):

The structure contains 5 items: algorithm Ana Bill button car

NODE.PY

"""File: node.py

Node classes for one-way linked structures and two-way

linked structures."""

class Node(object):

def __init__(self, data, next = None):

"""Instantiates a Node with default next of None"""

self.data = data

self.next = next

A5.PY

"""
File: a5.py


Define a length function.
Define a printStructure function.
Define an insert function.
Test the above functions and the Node class.
"""

from node import Node

def length(head):
    """Returns the number of items in the linked structure
    referred to by head."""
    probe = head
    count = 0
   
    # ADD CODE HERE: Count the number of nodes in the structure
   
    return count
   
def insert(newItem, head):
    """Inserts newItem at the correct position (ascending order) in
    the linked structure referred to by head.
    Returns a reference to the new structure."""
    # if head == None:
        # if structure is empty
        # ADD CODE HERE       
    # else:
        #Insert newItem in its place (ascending order)
      # ADD CODE HERE
       
    return head

def printStructure(head):
    """Prints the items in the structure referred to by head."""
    # ADD CODE HERE

def main():
    """Gets words from the user and inserts in the
    structure referred to by head."""
   
    head = None
    userInput = input('Please enter a word (or just hit enter to end): ')
    while userInput != '':
        head = insert(userInput, head)
        userInput = input('Please enter a word (or just hit enter to end): ')
    print('The structure contains', length(head), 'items:')
    printStructure(head)

if __name__ == "__main__": main()

In: Computer Science

Imagine that you are a user in a hurry that types 2O (oh) rather than 20...

Imagine that you are a user in a hurry that types 2O (oh) rather than 20 (zero) as the height. What happens to your program? If the user enters a value that could not be converted to numeric type, allow 3 additional opportunities to enter a new value. If the user fails to enter a correct value after 4 attempts, inform them of such failure and allow the program to end without crashing.

Question: Can someone help me with this?

My original code:

# I put the area calculations of both the triangle and trapezoid up, so that the code could run through them both properly.
def triangle(height, base):
area_triangle = height * base * 0.5
print "the area of your triangle equals %s" % (area_triangle)
def trapezoid(height, base1, base2):
area_trapezoid = ((base1 + base2) / 2) * height
print "the area of your trapezoid equals %s" % (area_trapezoid)
# Giving the option to choose triangle or trapezoid area.
shapes = ["triangle", "trapezoid"]
# I gave my code a title and put my name on it.
print "Area calculator"
print "Made by Alison Voigt"
print "-------------------------------"
# Asking the user to enter either the triangle or the trapezoid to move on to the area calculation.
def calculation():
print "please type the name of your shape"
print "(triangle, trapezoid)"
# Once the user chooses a shape they are asked to enter in the height, and base(s) for the shape of their choosing.
user_shape = raw_input()
if user_shape == shapes[1]:
trapezoid(height = float(raw_input("please type the height of the trapezoid.")), base1 = float(raw_input("please type the base1 length of the trapezoid.")), base2 = float(raw_input("please type the base2 length of the trapezoid.")))
elif user_shape == shapes[0]:
triangle(height = float(raw_input("please type the height of the triangle.")), base = float(raw_input("please type the base length of the triangle.")))
# If the user enters in wrong answer the code will tell you to try again.
else:
print "That's not in the choices!, Try again."
calculation()
# The user is now given the option to calculate the same shape or the other.
calculation()
choice = raw_input("Would you like to calculate the area of a different shape?(yes/no)")
while choice == "yes":
print "---------------------"
calculation()

In: Computer Science

1. If I can assume "not P" and derive "not Q", I have completed an indirect...

1. If I can assume "not P" and derive "not Q", I have completed an indirect proof of the statement "P → Q".

T/F? Why?

2. If I want to prove "P → (x XOR NOT y)", it suffices to prove "P → (x AND y)".

T/F? Why?

3. Suppose I assume "A" and derive "B". Then I start over, assume "not B", and derive a contradiction. Then I may conclude that A is a tautology.

T/F? Why?

4. Suppose I first assume "A xor B" and prove "C".

Then I start over, assume "P", and prove "A and not B".

Finally I start again, assume "Q", and prove "not A and B".

Then I may conclude "(P or Q) → C".

T/F? Why?

5. Suppose I first assume A and derive B.

Then I start over, assume "not C", and derive "not B".

Then I start over, assume "C and not A", and derive "0".

I can now conclude that A, B, and C are all equivalent to one another.

T/F? Why?

In: Computer Science

Discussing - Network Security a) Discuss the relative merits of traditional signature-based IDS/IPS technology with newer...

Discussing - Network Security
a) Discuss the relative merits of traditional signature-based IDS/IPS technology with newer form, such as application awareness and anomaly detection.

b) Discuss and develop a theoretical network architecture for a small business in the area that wishes to expand into new facilities, like a colocation center in the downtown area.

In: Computer Science

Q. In java, I would like to know, especially how the program detect there is an...

Q. In java, I would like to know, especially how the program detect there is an error which is user should put only numerical data but if user put letter data (five, sixty instead of 5,60), *I want the program display "Invalid data. Please try again" instead of long error message(from the IDE)* when user put letter data(five, sixty stuff...) and GO BACK TO THE BEGINNING SO USER CAN PUT THE DATA AGAIN!

Write a program that counts change. The program should ask for the number of quarters, the number of dimes, the number of nickels and the number of pennies. The program should then compute the value of all the coins and tell the user how much money there is, expressed in dollars. Display a title at the top of the screen when the program first runs. You must use constants for the value of each coin type. Multiply the number of each coin times the value for each coin (the defined constant). Refer to the PowerPoint or video on the use of the constants.

1) if quarters =100 dimes = 100 nickels = 100 pennies = 99

=>expected result = 40.99

2) if quarters = hundred dimes = hundred nickels = nine pennies = hundred

=> expected result ""Invalid data. Please try again" (GO BACK TO THE BEGINNING, SO USER CAN PUT THE DATA AGAIN!) <- this is the part i am struggling. Please Help!

In: Computer Science

1. Circle: Implement a Java class with the name Circle. It should be in the package...

1. Circle:

Implement a Java class with the name Circle. It should be in the package edu.gcccd.csis.

The class has two private instance variables: radius (of the type double) and color (of the type String).

The class also has a private static variable: numOfCircles (of the type long) which at all times will keep track of the number of Circle objects that were instantiated.

Construction:

A constructor that constructs a circle with the given color and sets the radius to a default value of 1.0.

A constructor that constructs a circle with the given, radius and color.

Once constructed, the value of the radius must be immutable (cannot be allowed to be modified)

Behaviors:

Accessor and Mutator aka Getter and Setter for the color attribute

Accessor for the radius.

getArea() and getCircumference() methods, hat return the area and circumference of this Circle in double.

Hint: use Math.PI (https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#PI (Links to an external site.))

2. Rectangle:

Implement a Java class with the name Rectangle. It should be in the package edu.gcccd.csis.

The class has two private instance variables: width and height (of the type double)

The class also has a private static variable: numOfRectangles (of the type long) which at all times will keep track of the number of Rectangle objects that were instantiated.

Construction:

A constructor that constructs a Rectangle with the given width and height.

A default constructor.

Behaviors:

Accessor and Mutator aka Getter and Setter for both member variables.

getArea() and getCircumference() methods, that return the area and circumference of this Rectangle in double.

a boolean method isSquare(), that returns true is this Rectangle is a square.

Hint: read the first 10 pages of Chapter 5 in your text.

3. Container

Implement a Java class with the name Container. It should be in the package edu.gcccd.csis.

The class has two private instance variables: rectangle of type Rectangle and circle of type Circle.

Construction:

No explicit constructors.

Behaviors:

Accessor and Mutator aka Getter and Setter for both member variables.

an integer method size(), that returns 0, if all member variables are null, 1 either of the two member variables contains a value other than null, and 2, if both, the rectangle and circle contain values other than null.

In: Computer Science