SlideShare uma empresa Scribd logo
1 de 1
Write new code:
1. Create a project in NetBeans and name the project Hw04. 2. Design and create a class that
holds a student's first name, last name, total earned credit hours, total quality points, and GPA.
The definition of the class is given as follows: publi, // default constructor public
StudentRecord() { // add code here to initialize data members of the class } // constructor //
paramters: nm: name, Eh: Earned credit hours, QPts: Total quality points public StudentRecord
(string nm, int Eh, int QPts) { // add code here to initialize data members of the class } // get the
name of the student public string getName() { // add code here } // get earned hours public int
getEarnedCh() { // add code here } // get total quality points public int getQualPts( ) // add code
here } // get GPA public double getGPA( { // add code here } // Change the student's name
public void setName(string nm ) { // add code here } // Change earned hours and update GPA
public void setEarnedCh(int Eh) { // add code here public interface SortInterface { / This
method sorts the items of the StudentRecord array according to students' GPA in ascending order
/ void sortGPA(StudentRecord v [ ] , int n ) ; // n is number of valid elements in the array y
public class Sort implements SortInterface { public void sortGPA(StudentRecord v [ ] , int n ) {
// add code here y / This method searches an item in a StudentRecord array v using a specific
GPA. If a match found, the method returns the index of the item in the array. Otherwise, the
method returns 1 . You must use binary search algorithm to implement the method (assume the
array is sorted according to students' GPA). Parameter n is the number of valid elements in the
array / public int SearchGPA(StudentRecord v [ ] , int n , double gpa) { // add code here } 4.
Write a test program that (1) Defines a StudentRecord array and necessary variables (2) Reads
student's name, earned credit hours, and total quality points from keyboard, and stores them as an
item (StudentRecord object) in the array (3) Repeat (2) for more items until user presses a
specific key to stop it (4) Sorts the array by calling the method SortGPA() (6) Ask user for a
GPA, and call the method SearchGPA() to search the array. If a match is found, i.e, there is an
item with the target GPA in the array, display the information of item in the following format:
(assume 2.00 is target GPA) Found a record: Name: Steven Liu Credit Hours: 30 QualityPoints:
60 GPA: 2.00 If no match is found, display No matched record!

Mais conteúdo relacionado

Semelhante a Write new code- 1- Create a project in NetBeans and name the project H.docx

Student.h #include stdafx.h #include string using names.pdf
Student.h #include stdafx.h #include string using names.pdfStudent.h #include stdafx.h #include string using names.pdf
Student.h #include stdafx.h #include string using names.pdffoottraders
 
Java căn bản - Chapter7
Java căn bản - Chapter7Java căn bản - Chapter7
Java căn bản - Chapter7Vince Vo
 
Assignment 7
Assignment 7Assignment 7
Assignment 7IIUM
 
A457405934_21789_26_2018_Inheritance.ppt
A457405934_21789_26_2018_Inheritance.pptA457405934_21789_26_2018_Inheritance.ppt
A457405934_21789_26_2018_Inheritance.pptRithwikRanjan
 
Chapter 6.5 new
Chapter 6.5 newChapter 6.5 new
Chapter 6.5 newsotlsoc
 
Teacher.javaimport java.util.Arrays; import java.util.Scanner;.pdf
Teacher.javaimport java.util.Arrays; import java.util.Scanner;.pdfTeacher.javaimport java.util.Arrays; import java.util.Scanner;.pdf
Teacher.javaimport java.util.Arrays; import java.util.Scanner;.pdfkareemangels
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slotsmha4
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slotsmha4
 

Semelhante a Write new code- 1- Create a project in NetBeans and name the project H.docx (11)

Student.h #include stdafx.h #include string using names.pdf
Student.h #include stdafx.h #include string using names.pdfStudent.h #include stdafx.h #include string using names.pdf
Student.h #include stdafx.h #include string using names.pdf
 
Java căn bản - Chapter7
Java căn bản - Chapter7Java căn bản - Chapter7
Java căn bản - Chapter7
 
Assignment 7
Assignment 7Assignment 7
Assignment 7
 
Java chapter 4
Java chapter 4Java chapter 4
Java chapter 4
 
Invoke dynamics
Invoke dynamicsInvoke dynamics
Invoke dynamics
 
A457405934_21789_26_2018_Inheritance.ppt
A457405934_21789_26_2018_Inheritance.pptA457405934_21789_26_2018_Inheritance.ppt
A457405934_21789_26_2018_Inheritance.ppt
 
Chapter 6.5 new
Chapter 6.5 newChapter 6.5 new
Chapter 6.5 new
 
Teacher.javaimport java.util.Arrays; import java.util.Scanner;.pdf
Teacher.javaimport java.util.Arrays; import java.util.Scanner;.pdfTeacher.javaimport java.util.Arrays; import java.util.Scanner;.pdf
Teacher.javaimport java.util.Arrays; import java.util.Scanner;.pdf
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots
 
Oop
OopOop
Oop
 

Mais de Sebastian6SWSlaterb

You have the chance to participate in a project that produces the foll.docx
You have the chance to participate in a project that produces the foll.docxYou have the chance to participate in a project that produces the foll.docx
You have the chance to participate in a project that produces the foll.docxSebastian6SWSlaterb
 
You complete a 3-point cross and obtain the following data- Must compl.docx
You complete a 3-point cross and obtain the following data- Must compl.docxYou complete a 3-point cross and obtain the following data- Must compl.docx
You complete a 3-point cross and obtain the following data- Must compl.docxSebastian6SWSlaterb
 
Yosemite Clothing Co- has paid a constant annual dividend of $2-40 a s.docx
Yosemite Clothing Co- has paid a constant annual dividend of $2-40 a s.docxYosemite Clothing Co- has paid a constant annual dividend of $2-40 a s.docx
Yosemite Clothing Co- has paid a constant annual dividend of $2-40 a s.docxSebastian6SWSlaterb
 
Yield to maturity The bond shown in the following table pays interest.docx
Yield to maturity The bond shown in the following table pays interest.docxYield to maturity The bond shown in the following table pays interest.docx
Yield to maturity The bond shown in the following table pays interest.docxSebastian6SWSlaterb
 
Write the truth table and desing the cirwit for the following furstion.docx
Write the truth table and desing the cirwit for the following furstion.docxWrite the truth table and desing the cirwit for the following furstion.docx
Write the truth table and desing the cirwit for the following furstion.docxSebastian6SWSlaterb
 
write report for Normalization with Examples.docx
write report for Normalization with Examples.docxwrite report for Normalization with Examples.docx
write report for Normalization with Examples.docxSebastian6SWSlaterb
 
Write the algorithm to program the Mechanical Man to carry out the fol.docx
Write the algorithm to program the Mechanical Man to carry out the fol.docxWrite the algorithm to program the Mechanical Man to carry out the fol.docx
Write the algorithm to program the Mechanical Man to carry out the fol.docxSebastian6SWSlaterb
 
Write the code in python for below problem- Implement a performance-me.docx
Write the code in python for below problem- Implement a performance-me.docxWrite the code in python for below problem- Implement a performance-me.docx
Write the code in python for below problem- Implement a performance-me.docxSebastian6SWSlaterb
 
Write out all functions f-{1-2}{a-b-c-d} (in two-line notation)- How m.docx
Write out all functions f-{1-2}{a-b-c-d} (in two-line notation)- How m.docxWrite out all functions f-{1-2}{a-b-c-d} (in two-line notation)- How m.docx
Write out all functions f-{1-2}{a-b-c-d} (in two-line notation)- How m.docxSebastian6SWSlaterb
 
Write the R programming code for computing the mean- median- mode- qua.docx
Write the R programming code for computing the mean- median- mode- qua.docxWrite the R programming code for computing the mean- median- mode- qua.docx
Write the R programming code for computing the mean- median- mode- qua.docxSebastian6SWSlaterb
 
write short notes about flu (influenza)what us this illness - mechanis.docx
write short notes about flu (influenza)what us this illness - mechanis.docxwrite short notes about flu (influenza)what us this illness - mechanis.docx
write short notes about flu (influenza)what us this illness - mechanis.docxSebastian6SWSlaterb
 
Zorunlu karlk orannn -20 olduunu varsayalm- 40 milyon dolarlk bir naki.docx
Zorunlu karlk orannn -20 olduunu varsayalm- 40 milyon dolarlk bir naki.docxZorunlu karlk orannn -20 olduunu varsayalm- 40 milyon dolarlk bir naki.docx
Zorunlu karlk orannn -20 olduunu varsayalm- 40 milyon dolarlk bir naki.docxSebastian6SWSlaterb
 
Z Industries income statement for the year- Z Industries has on its ba.docx
Z Industries income statement for the year- Z Industries has on its ba.docxZ Industries income statement for the year- Z Industries has on its ba.docx
Z Industries income statement for the year- Z Industries has on its ba.docxSebastian6SWSlaterb
 
Z Industries has on its balance sheet $6 million in net operating work.docx
Z Industries has on its balance sheet $6 million in net operating work.docxZ Industries has on its balance sheet $6 million in net operating work.docx
Z Industries has on its balance sheet $6 million in net operating work.docxSebastian6SWSlaterb
 
Your patient had his 63rd birthday 5 months ago is visiting you in May.docx
Your patient had his 63rd birthday 5 months ago is visiting you in May.docxYour patient had his 63rd birthday 5 months ago is visiting you in May.docx
Your patient had his 63rd birthday 5 months ago is visiting you in May.docxSebastian6SWSlaterb
 
Your firm decides to convert $100-000 in USD to euros and deposit the (1).docx
Your firm decides to convert $100-000 in USD to euros and deposit the (1).docxYour firm decides to convert $100-000 in USD to euros and deposit the (1).docx
Your firm decides to convert $100-000 in USD to euros and deposit the (1).docxSebastian6SWSlaterb
 
You write put options on 1000 shares of Facebook with a strike of $101.docx
You write put options on 1000 shares of Facebook with a strike of $101.docxYou write put options on 1000 shares of Facebook with a strike of $101.docx
You write put options on 1000 shares of Facebook with a strike of $101.docxSebastian6SWSlaterb
 
You must implement the following functions- Name the functions exactly.docx
You must implement the following functions- Name the functions exactly.docxYou must implement the following functions- Name the functions exactly.docx
You must implement the following functions- Name the functions exactly.docxSebastian6SWSlaterb
 

Mais de Sebastian6SWSlaterb (20)

You have the chance to participate in a project that produces the foll.docx
You have the chance to participate in a project that produces the foll.docxYou have the chance to participate in a project that produces the foll.docx
You have the chance to participate in a project that produces the foll.docx
 
You complete a 3-point cross and obtain the following data- Must compl.docx
You complete a 3-point cross and obtain the following data- Must compl.docxYou complete a 3-point cross and obtain the following data- Must compl.docx
You complete a 3-point cross and obtain the following data- Must compl.docx
 
x2 is even x+1 is odd.docx
x2 is even x+1 is odd.docxx2 is even x+1 is odd.docx
x2 is even x+1 is odd.docx
 
Yosemite Clothing Co- has paid a constant annual dividend of $2-40 a s.docx
Yosemite Clothing Co- has paid a constant annual dividend of $2-40 a s.docxYosemite Clothing Co- has paid a constant annual dividend of $2-40 a s.docx
Yosemite Clothing Co- has paid a constant annual dividend of $2-40 a s.docx
 
Yield to maturity The bond shown in the following table pays interest.docx
Yield to maturity The bond shown in the following table pays interest.docxYield to maturity The bond shown in the following table pays interest.docx
Yield to maturity The bond shown in the following table pays interest.docx
 
Write the truth table and desing the cirwit for the following furstion.docx
Write the truth table and desing the cirwit for the following furstion.docxWrite the truth table and desing the cirwit for the following furstion.docx
Write the truth table and desing the cirwit for the following furstion.docx
 
write report for Normalization with Examples.docx
write report for Normalization with Examples.docxwrite report for Normalization with Examples.docx
write report for Normalization with Examples.docx
 
Write the algorithm to program the Mechanical Man to carry out the fol.docx
Write the algorithm to program the Mechanical Man to carry out the fol.docxWrite the algorithm to program the Mechanical Man to carry out the fol.docx
Write the algorithm to program the Mechanical Man to carry out the fol.docx
 
Write the code in python for below problem- Implement a performance-me.docx
Write the code in python for below problem- Implement a performance-me.docxWrite the code in python for below problem- Implement a performance-me.docx
Write the code in python for below problem- Implement a performance-me.docx
 
Write out all functions f-{1-2}{a-b-c-d} (in two-line notation)- How m.docx
Write out all functions f-{1-2}{a-b-c-d} (in two-line notation)- How m.docxWrite out all functions f-{1-2}{a-b-c-d} (in two-line notation)- How m.docx
Write out all functions f-{1-2}{a-b-c-d} (in two-line notation)- How m.docx
 
Write the R programming code for computing the mean- median- mode- qua.docx
Write the R programming code for computing the mean- median- mode- qua.docxWrite the R programming code for computing the mean- median- mode- qua.docx
Write the R programming code for computing the mean- median- mode- qua.docx
 
{0i1ji-j and i-2j}.docx
{0i1ji-j and i-2j}.docx{0i1ji-j and i-2j}.docx
{0i1ji-j and i-2j}.docx
 
write short notes about flu (influenza)what us this illness - mechanis.docx
write short notes about flu (influenza)what us this illness - mechanis.docxwrite short notes about flu (influenza)what us this illness - mechanis.docx
write short notes about flu (influenza)what us this illness - mechanis.docx
 
Zorunlu karlk orannn -20 olduunu varsayalm- 40 milyon dolarlk bir naki.docx
Zorunlu karlk orannn -20 olduunu varsayalm- 40 milyon dolarlk bir naki.docxZorunlu karlk orannn -20 olduunu varsayalm- 40 milyon dolarlk bir naki.docx
Zorunlu karlk orannn -20 olduunu varsayalm- 40 milyon dolarlk bir naki.docx
 
Z Industries income statement for the year- Z Industries has on its ba.docx
Z Industries income statement for the year- Z Industries has on its ba.docxZ Industries income statement for the year- Z Industries has on its ba.docx
Z Industries income statement for the year- Z Industries has on its ba.docx
 
Z Industries has on its balance sheet $6 million in net operating work.docx
Z Industries has on its balance sheet $6 million in net operating work.docxZ Industries has on its balance sheet $6 million in net operating work.docx
Z Industries has on its balance sheet $6 million in net operating work.docx
 
Your patient had his 63rd birthday 5 months ago is visiting you in May.docx
Your patient had his 63rd birthday 5 months ago is visiting you in May.docxYour patient had his 63rd birthday 5 months ago is visiting you in May.docx
Your patient had his 63rd birthday 5 months ago is visiting you in May.docx
 
Your firm decides to convert $100-000 in USD to euros and deposit the (1).docx
Your firm decides to convert $100-000 in USD to euros and deposit the (1).docxYour firm decides to convert $100-000 in USD to euros and deposit the (1).docx
Your firm decides to convert $100-000 in USD to euros and deposit the (1).docx
 
You write put options on 1000 shares of Facebook with a strike of $101.docx
You write put options on 1000 shares of Facebook with a strike of $101.docxYou write put options on 1000 shares of Facebook with a strike of $101.docx
You write put options on 1000 shares of Facebook with a strike of $101.docx
 
You must implement the following functions- Name the functions exactly.docx
You must implement the following functions- Name the functions exactly.docxYou must implement the following functions- Name the functions exactly.docx
You must implement the following functions- Name the functions exactly.docx
 

Último

ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 

Último (20)

ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 

Write new code- 1- Create a project in NetBeans and name the project H.docx

  • 1. Write new code: 1. Create a project in NetBeans and name the project Hw04. 2. Design and create a class that holds a student's first name, last name, total earned credit hours, total quality points, and GPA. The definition of the class is given as follows: publi, // default constructor public StudentRecord() { // add code here to initialize data members of the class } // constructor // paramters: nm: name, Eh: Earned credit hours, QPts: Total quality points public StudentRecord (string nm, int Eh, int QPts) { // add code here to initialize data members of the class } // get the name of the student public string getName() { // add code here } // get earned hours public int getEarnedCh() { // add code here } // get total quality points public int getQualPts( ) // add code here } // get GPA public double getGPA( { // add code here } // Change the student's name public void setName(string nm ) { // add code here } // Change earned hours and update GPA public void setEarnedCh(int Eh) { // add code here public interface SortInterface { / This method sorts the items of the StudentRecord array according to students' GPA in ascending order / void sortGPA(StudentRecord v [ ] , int n ) ; // n is number of valid elements in the array y public class Sort implements SortInterface { public void sortGPA(StudentRecord v [ ] , int n ) { // add code here y / This method searches an item in a StudentRecord array v using a specific GPA. If a match found, the method returns the index of the item in the array. Otherwise, the method returns 1 . You must use binary search algorithm to implement the method (assume the array is sorted according to students' GPA). Parameter n is the number of valid elements in the array / public int SearchGPA(StudentRecord v [ ] , int n , double gpa) { // add code here } 4. Write a test program that (1) Defines a StudentRecord array and necessary variables (2) Reads student's name, earned credit hours, and total quality points from keyboard, and stores them as an item (StudentRecord object) in the array (3) Repeat (2) for more items until user presses a specific key to stop it (4) Sorts the array by calling the method SortGPA() (6) Ask user for a GPA, and call the method SearchGPA() to search the array. If a match is found, i.e, there is an item with the target GPA in the array, display the information of item in the following format: (assume 2.00 is target GPA) Found a record: Name: Steven Liu Credit Hours: 30 QualityPoints: 60 GPA: 2.00 If no match is found, display No matched record!